I know this sounds odd. But this worked for me recently. It can be caused
by a corrupt .pyc file.
Try deleting the .pyc files and see if the problem remains.
On Thursday, 28 February 2019 20:54:24 UTC+1, Ben Duncan wrote:
>
> Getting the following errors when trying to import a module
> Module directory looks like:
>
> [web2py@su-postgres-ben-3 Book]$ ls -la modules/
> total 16
> drwxr-xr-x 2 web2py web2py 4096 Feb 28 13:49 .
> drwxrwxr-x 15 web2py web2py 4096 Feb 25 14:33 ..
> -rw-rw-r-- 1 web2py web2py 256 Jan 30 10:48 emptysample.py
> -rw-rw-r-- 1 web2py web2py 0 Feb 28 13:32 __init__.py
> -rw-rw-r-- 1 web2py web2py 250 Feb 28 13:49 *testmod.py*
> [web2py@su-postgres-ben-3 Book]$
>
> controller looks like:
>
> def login():
> *from testmod import **
> FRM_ERR = 'N'
> CHOOSE_COMPANY = 'N'
> print
> "-----------------------------------------------------------------\n"
> print "Doing the LOGIN form ...\n"
> print "LOGIN: default frm-err: \n ", FRM_ERR
> ............
>
> What gives, book says it should work fine ...
> Restarted several times and tried various name changes ...
>
> Thanks ...
> Error ticket for "Book" Ticket ID
>
> 10.13.69.144.2019-02-28.13-47-50.cf8b0622-c9d2-457d-be0d-93c11fb1251c
> <type 'exceptions.ImportError'> (ImportError('No module named
> Book.modules.testmod',), <traceback object at 0x7feb571ef560>) Version
> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.11.34.06
> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
>
> Traceback (most recent call last):
> File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
> File "/data/web2py/web2py/applications/Book/controllers/default.py"
> <https://10.13.70.47/admin/default/edit/Book/controllers/default.py>, line
> 510, in <module>
> File "/data/web2py/web2py/gluon/globals.py", line 421, in <lambda>
> self._caller = lambda f: f()
> File "/data/web2py/web2py/applications/Book/controllers/default.py"
> <https://10.13.70.47/admin/default/edit/Book/controllers/default.py>, line
> 109, in login
> from testmod import *
> File "/data/web2py/web2py/gluon/custom_import.py", line 104, in
> custom_importer
> raise ImportError(e1, import_tb) # there an import error in the module
> ImportError: (ImportError('No module named Book.modules.testmod',),
> <traceback object at 0x7feb571ef560>)
>
> Error snapshot [image: help]
> <https://10.13.70.47/admin/default/ticket/Book/10.13.69.144.2019-02-28.13-47-50.cf8b0622-c9d2-457d-be0d-93c11fb1251c#>
>
>
> <type 'exceptions.ImportError'>((ImportError('No module named
> Book.modules.testmod',), <traceback object at 0x7feb571ef560>))
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.