Ok further testing* REVELS* that if the module begins with 'test',
cutome_import chokes and pukes.
Named it to bensmodule and it works .......

*Massimo*, is that expected behavior ?

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Fri, Mar 1, 2019 at 6:25 AM Ben Duncan <linux...@gmail.com> wrote:

> Ok, tried the deleting of ALL pyc, even moved the test module to gluon and
> tried:
>
> [web2py@su-postgres-ben-3 Book]$ cp -av modules/testmod/testmod.py
> ../../gluon/
> `modules/testmod/testmod.py' -> `../../gluon/testmod.py'
> [web2py@su-postgres-ben-3 Book]$ ls -la ../../gluon/testmod.py
> -rw-rw-r-- 1 web2py web2py 250 Feb 28 13:49 ../../gluon/testmod.py
> [web2py@su-postgres-ben-3 Book]$
>
> And still got:
> Seems to me cutom_import is borken.
>
> Error ticket for "Book" Ticket ID
>
> 10.13.69.144.2019-03-01.06-22-33.1284ee98-507a-49ff-a358-f3e409dff1fc
> <type 'exceptions.ImportError'> (ImportError('No module named testmod',),
> <traceback object at 0x7fc9ff98c560>) 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 testmod',), <traceback object at 
> 0x7fc9ff98c560>)
>
> Error snapshot [image: help]
> <https://10.13.70.47/admin/default/ticket/Book/10.13.69.144.2019-03-01.06-22-33.1284ee98-507a-49ff-a358-f3e409dff1fc#>
>
> <type 'exceptions.ImportError'>((ImportError('No module named testmod',),
> <traceback object at 0x7fc9ff98c560>))
>
> inspect attributes
> Frames
>
>    -
>
>    *File /data/web2py/web2py/gluon/restricted.py in restricted at line
>    219* code arguments variables
>    -
>
>    *File /data/web2py/web2py/applications/Book/controllers/default.py in
>    <module> at line 510* code arguments variables
>    -
>
>    *File /data/web2py/web2py/gluon/globals.py in <lambda> at line 421*
>    code arguments variables
>    -
>
>    *File /data/web2py/web2py/applications/Book/controllers/default.py in
>    login at line 109* code arguments variables
>    -
>
>    *File /data/web2py/web2py/gluon/custom_import.py in custom_importer at
>    line 104* code arguments variables
>    Function argument list
>
>    (name='testmod', globals={'A': <class 'gluon.html.A'>, 'ANY_OF':
>    <class 'gluon.validators.ANY_OF'>, 'ASSIGNJS': <function ASSIGNJS>,
>    'AppConfig': <function AppConfig>, 'B': <class 'gluon.html.B'>, 'BEAUTIFY':
>    <class 'gluon.html.BEAUTIFY'>, 'BODY': <class 'gluon.html.BODY'>, 'BR':
>    <class 'gluon.html.BR'>, 'BUTTON': <class 'gluon.html.BUTTON'>,
>    'BytesIO': <built-in function StringIO>, ...}, locals={}, fromlist=('*',),
>    level=-1)
>    Code listing
>
>    99.
>    100.
>    101.
>    102.
>    103.
>    104.
>    105.
>    106.
>    107.
>    108.
>
>            except ImportError as e1:
>                import_tb = sys.exc_info()[2]
>                try:
>                    return NATIVE_IMPORTER(name, globals, locals, fromlist, 
> level)
>                except (ImportError, KeyError) as e3:
>                    raise ImportError(e1, import_tb)  # there an import error 
> in the module
>            except Exception as e2:
>                raise  # there is an error in the module
>            finally:
>                if import_tb:
>
>    Variables
>    builtinImportError <type 'exceptions.ImportError'>
>    e1 ImportError('No module named testmod',)
>    import_tb None
>
> Context
>
> locals request session response
> In file: /data/web2py/web2py/applications/Book/controllers/default.py
>
> 1.
>
> <code object <module> at 0x7fc9ff98a930, file 
> "/data/web2py/web2py/applications/Book/controllers/default.py", line 12>
>
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Fri, Mar 1, 2019 at 6:21 AM Ben Duncan <linux...@gmail.com> wrote:
>
>> Dave: Yes   same level.
>>
>> Paul will try deleting the pyc files ...
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Fri, Mar 1, 2019 at 12:26 AM Paul Ellis <eddie.dig...@gmail.com>
>> wrote:
>>
>>> 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 web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to