modules: NameError("name 'reload' is not defined",)

231 views
Skip to first unread message

Serge Bourgeois

unread,
Jun 24, 2020, 6:36:36 AM6/24/20
to web2py-users

I have an issue saving my modues with the last version of web2py.
Is there something I do wrong?

Context: Ubuntu 18.04 / web2py version 2.20.4 / python 3.6.9

How to reproduce this issue (a bug??) with a simple example:

In the applications examples, create a module (for instance empty.py)

Then open it,
The file contains 3 lines:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gluon import *

do not change anything and save it (ctrl + S)...

=> Since the last version, I get the following message:

 Impossible de recharger le module car:
 NameError("name 'reload' is not defined",)

Thanks for any advise...

Vlad

unread,
Aug 16, 2020, 6:09:28 AM8/16/20
to web2py-users
same error, though with a lot more than 3 lines

Annet

unread,
Aug 18, 2020, 1:08:14 AM8/18/20
to web2py-users
I reported the same problem some time ago.

When I edit a module and save it I get this nameError. Since I am
importing the modules into other applications I have to restart web2py
everytime I edit a module.

Further more the module are no longer compiled on first use, which
I also find very annoying.

Annet

Op zondag 16 augustus 2020 om 12:09:28 UTC+2 schreef Vlad:

Kevin Keller

unread,
Aug 18, 2020, 9:52:43 AM8/18/20
to web2py-users
Same issue here with newest web2py

--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/56370ed0-27a0-4b3d-a984-2fd6ac7bb964n%40googlegroups.com.

xgp.l...@gmail.com

unread,
Aug 18, 2020, 9:56:05 AM8/18/20
to web2py-users
Hi,

I already open a conversation about this but no complete answers were given.
I ran from source and experience the same error.


Cheers,

Kevin Keller

unread,
Aug 18, 2020, 10:05:17 AM8/18/20
to web2py-users
I see there is an open issue on git from 8 days ago:


So just FYI it is already reported. 

Its a strange error. 

Must be somewhere in the module save function and after save it should trigger the compile which obviously does not work anymore either. 

Should be a small thing 

AGRogers

unread,
Aug 18, 2020, 7:38:30 PM8/18/20
to web...@googlegroups.com
I am completely out of my depth re this issue. But I just read the following on the py4web group and wondered whether it might be related.

Proper use of modules
Q from Richard: Where do modules go?
A I think proper modules should be installed with pip but if you want to distribute the source of
your own pure python module with an app I say place it under a new folder
apps/yourapp/modules and make sure there is an "__init__.py" in there. Do not install it in
the path otherwise may interfere with modules with similar names used by other apps in the
same apps. Related Q: So "__init__.py" lives in apps/yourapp/modules? A: Not any module
will work this way. files in the module must use the "from . xyz import" notation and not
"from thismodule import" notation
Any subfolder of an app that contains python code should have an __init__.py
empty one


xgp.l...@gmail.com

unread,
Aug 19, 2020, 9:21:18 AM8/19/20
to web...@googlegroups.com
Hi,

Looking for the solution to this matter also.

When using from gluon.custom_import import track_changes; track_changes(True)

File "web2py/gluon/custom_import.py", line 109, in __call__
result = NATIVE_IMPORTER(name, globals, locals, fromlist, level)



When not using from gluon.custom_import import track_changes; track_changes(True)

 for itemname in name.split("."):
new_mod = base_importer( modules_prefix, globals, locals, (itemname,), level)
modules_prefix += "." + itemname

Var new_mod is never used why?



File mytest.py is placed under the modules folder.


Regards,

El Tuesday, August 18, 2020 a la(s) 8:52:43 AM UTC-5, kell...@gmail.com escribió:
Reply all
Reply to author
Forward
0 new messages