问题
I am hosting my Web2py app on PythonAnyware and have an issue importing copy_reg which web2py apparently needs. In previous versions this was no issue.
The trace back is as follows: Traceback (most recent call last):
File "/home/richdijk/web2py/gluon/restricted.py", line 220, in restricted exec ccode in environment File "/home/richdijk/web2py/applications/im/models/db.py", line 78, in <module> auth.define_tables(username=False, signature=False) File "/home/richdijk/web2py/gluon/tools.py", line 1784, in define_tables format='%(first_name)s %(last_name)s (%(id)s)')) File "/home/richdijk/web2py/gluon/dal.py", line 8223, in define_table table = self.lazy_define_table(tablename,*fields,**args) File "/home/richdijk/web2py/gluon/dal.py", line 8260, in lazy_define_table polymodel=polymodel) File "/home/richdijk/web2py/gluon/dal.py", line 1122, in create_table sql_fields_old = pickle.load(tfile) File "/home/richdijk/web2py/gluon/custom_import.py", line 92, in custom_importer return base_importer(pname, globals, locals, fromlist, level) ImportError: No module named copy_reg
Does anybody know the resolution for this? Thank you
回答1:
For future reference:
Most often you should clear the cache and sessions. Use the appadmin interface to have a gui for this. This solved the issue for me more than once.
Sessions are pickled files which might lead to these problems. For example if you synchronize between different platforms, python versions and maybe sometimes even between upgrades on web2py (though i'm not certain on the latter).
来源:https://stackoverflow.com/questions/25023485/can-not-import-copy-reg