Reputation: 3081
I have modules in the modules path in web2py and to import those modules i just put
import mymodule
it works perfectly but SOMETIME and somehow it crushs and show an error saying
ImportError: No module named mymodule
i wanted to use local_import
but it's no more supported in Web2py
> 1.99.5
to fix it i delete all .pyc
in web2py/gluon
then it works but sometime not
and even if everything work well, when i edit a module i must restart web2py to get the new modifaction!
Upvotes: 2
Views: 3261
Reputation: 25536
ImportError: No module named mymodule
I think sometimes you get that error when there's an error in the imported module itself (i.e., it doesn't properly pass through the real error). Try importing and using the module from a standard Python shell and see if there's an error in the module that needs to be fixed.
i wanted to use
local_import
but it's no more supported inWeb2py
>1.99.5
local_import
should still work, it's just no longer the preferred method. If it doesn't work, please report it as a bug.
when i edit a module i must restart web2py to get the new modifaction
Yes, that's how Python works. However, during development, you can have web2py automatically reload upon changes by doing the following:
from gluon.custom_import import track_changes; track_changes(True)
Upvotes: 2