No module named path

114 views
Skip to first unread message

Dave S

unread,
Dec 31, 2020, 5:22:36 PM12/31/20
to web2py-users
I'm moving my home development to   2.21.1-stable+timestamp.2020.11.28.04.10.44 after years of 2.14.6 and only dipping my toes into later versions.

The print -> print() and except E,e -> except E(e) was pretty minor, but I'm running into import errors for my app's module code.  I tried the fully qualified technique as in
which looks like
import sys,datetime,os,os.path,shutil,subprocess,urllib2,re
from gluon import *
import logging
from applications.badlist.modules.restuff import restuff

but I'm still getting

Traceback (most recent call last):
File "C:\Users\Dave\web2py_win\web2py_win_py27\web2py\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
File "C:/Users/Dave/web2py_win/web2py_win_py27/web2py/applications/myapp/controllers/default.py", line 13, in <module>
import restuff
File "C:\Users\Dave\web2py_win\web2py_win_py27\web2py\gluon\custom_import.py", line 74, in custom_importer
modules_prefix, globals, locals, (itemname,), level)
File "C:\Users\Dave\web2py_win\web2py_win_py27\web2py\gluon\custom_import.py", line 109, in __call__
result = NATIVE_IMPORTER(name, globals, locals, fromlist, level)
File "applications\badlist\modules\restuff.py", line 2, in <module>
import Cookie
File "C:\Users\Dave\web2py_win\web2py_win_py27\web2py\gluon\custom_import.py", line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
File "c:\users\nico\appdata\local\temp\pip-unpacked-wheel-tf9p4e\PyInstaller\loader\pyimod03_importers.py", line 157, in load_module
File "c:\users\nico\appdata\local\temp\pip-unpacked-wheel-tf9p4e\PyInstaller\loader\pyimod03_importers.py", line 391, in load_module
File "Cookie.py", line 217, in <module>
File "C:\Users\Dave\web2py_win\web2py_win_py27\web2py\gluon\custom_import.py", line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
File "c:\users\nico\appdata\local\temp\pip-unpacked-wheel-tf9p4e\PyInstaller\loader\pyimod03_importers.py", line 157, in load_module
File "c:\users\nico\appdata\local\temp\pip-unpacked-wheel-tf9p4e\PyInstaller\loader\pyimod03_importers.py", line 391, in load_module
File "warnings.py", line 6, in <module>
File "C:\Users\Dave\web2py_win\web2py_win_py27\web2py\gluon\custom_import.py", line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
File "c:\users\nico\appdata\local\temp\pip-unpacked-wheel-tf9p4e\PyInstaller\loader\pyimod03_importers.py", line 157, in load_module
File "c:\users\nico\appdata\local\temp\pip-unpacked-wheel-tf9p4e\PyInstaller\loader\pyimod03_importers.py", line 391, in load_module
File "linecache.py", line 9, in <module>
File "C:\Users\Dave\web2py_win\web2py_win_py27\web2py\gluon\custom_import.py", line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
File "c:\users\nico\appdata\local\temp\pip-unpacked-wheel-tf9p4e\PyInstaller\loader\pyimod03_importers.py", line 157, in load_module
File "c:\users\nico\appdata\local\temp\pip-unpacked-wheel-tf9p4e\PyInstaller\loader\pyimod03_importers.py", line 391, in load_module
File "os.py", line 120, in <module>
File "C:\Users\Dave\web2py_win\web2py_win_py27\web2py\gluon\custom_import.py", line 87, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ImportError: No module named path
Error snapshot 

<type 'exceptions.ImportError'>(No module named path)

I can skip this for now by isolating the functions that use the module, but this will soon be a big problem.  Suggestions?

(Google Groups dropped the "code block" button?  Pfui!

Dave
/dps

Dave S

unread,
Dec 31, 2020, 5:26:52 PM12/31/20
to web2py-users
On Thursday, December 31, 2020 at 2:22:36 PM UTC-8 Dave S wrote:
I'm moving my home development to   2.21.1-stable+timestamp.2020.11.28.04.10.44 after years of 2.14.6 and only dipping my toes into later versions.

The print -> print() and except E,e -> except E(e) was pretty minor, but I'm running into import errors for my app's module code.  I tried the fully qualified technique as in
which looks like
import sys,datetime,os,os.path,shutil,subprocess,urllib2,re
from gluon import *
import logging
from applications.badlist.modules.restuff import restuff

but I'm still getting
[...] 
<type 'exceptions.ImportError'>(No module named path)


Nevermind, I guess ... removing the explicit import seems to be a fix.

/dps
 

Dave S

unread,
Dec 31, 2020, 5:29:49 PM12/31/20
to web2py-users
Mind, please!   The "fix" only isolates the problem to the code using the module.

/dps
 

Dave S

unread,
Jan 11, 2021, 6:56:15 PM1/11/21
to web2py-users
On Thursday, December 31, 2020 at 2:29:49 PM UTC-8 Dave S wrote:
On Thursday, December 31, 2020 at 2:26:52 PM UTC-8 Dave S wrote:
On Thursday, December 31, 2020 at 2:22:36 PM UTC-8 Dave S wrote:
I'm moving my home development to   2.21.1-stable+timestamp.2020.11.28.04.10.44 after years of 2.14.6 and only dipping my toes into later versions.

The print -> print() and except E,e -> except E(e) was pretty minor, but I'm running into import errors for my app's module code.  I tried the fully qualified technique as in
which looks like
import sys,datetime,os,os.path,shutil,subprocess,urllib2,re
from gluon import *
import logging
from applications.badexample.modules.restuff import restuff

but I'm still getting
[...] 
<type 'exceptions.ImportError'>(No module named path)


Nevermind, I guess ... removing the explicit import seems to be a fix.

Mind, please!   The "fix" only isolates the problem to the code using the module.

No suggestions here?

/dps
 

Dave S

unread,
Jan 18, 2021, 6:27:35 PM1/18/21
to web2py-users
Piddling around,
I found I had an issue in restuff.py with "import Cookie", and the problem still exists with it's replacement "import cookielib".
And the problem exists with "import urllib2", even though controllers/default.py doesn't have problem with that line.

Default.py can import restuff.py just fine if I comment out those imports, but obviously I'm not handling cookies in this "fix".

/dps
Reply all
Reply to author
Forward
0 new messages