Massimo, importing copy_reg from the console works fine :)
Richard On Wednesday, July 23, 2014 11:20:06 AM UTC+2, Massimo Di Pierro wrote: > > I understand but can you open a web2py shell. from the console type: > > > $ cd web2py > $ python web2py.py -S welcome -P > >>> import copy_reg > > > > > On Wednesday, 23 July 2014 04:03:48 UTC-5, Richard wrote: >> >> When I add the import copy_reg in db.py I get the error: >> >> <type 'exceptions.ImportError'> No module named copy_reg >> >> In the python/Python-2.7.8/Lib directory are 3 copy_reg files: >> - copy_reg.py >> - copy_reg.pyc >> - copy_reg.pyo >> >> Maybe of any relevance: I run a shared Apache server with the following >> first line in cgihandler.py : >> #!/home4/mamplcom/python/Python-2.7.8/python >> >> >> >> On Tuesday, July 22, 2014 1:21:36 PM UTC+2, Massimo Di Pierro wrote: >>> >>> Copy reg is a python module. Can you import it from the normal python >>> shell? >>> >>> On Tuesday, 22 July 2014 06:05:06 UTC-5, Richard wrote: >>>> >>>> Hi, >>>> >>>> I have an issue with adjusting the auth tables resulting in a custom >>>> import and an error that copy_reg can not be imported. >>>> >>>> The error trace is: >>>> >>>> Traceback (most recent call last): >>>> File "/home4/mamplcom/public_html/cgi-bin/gluon/restricted.py", line >>>> 220, in restricted >>>> exec ccode in environment >>>> File "/home4/mamplcom/public_html/cgi-bin/applications/im/models/db.py" >>>> <https://www.mampl.com/admin/default/edit/im/models/db.py>, line 74, in >>>> <module> >>>> auth.define_tables(username=False, signature=False) >>>> File "/home4/mamplcom/public_html/cgi-bin/gluon/tools.py", line 1784, in >>>> define_tables >>>> format='%(first_name)s %(last_name)s (%(id)s)')) >>>> File "/home4/mamplcom/public_html/cgi-bin/gluon/dal.py", line 8226, in >>>> define_table >>>> table = self.lazy_define_table(tablename,*fields,**args) >>>> File "/home4/mamplcom/public_html/cgi-bin/gluon/dal.py", line 8263, in >>>> lazy_define_table >>>> polymodel=polymodel) >>>> File "/home4/mamplcom/public_html/cgi-bin/gluon/dal.py", line 1125, in >>>> create_table >>>> sql_fields_old = pickle.load(tfile) >>>> File "/home4/mamplcom/public_html/cgi-bin/gluon/custom_import.py", line >>>> 92, in custom_importer >>>> return base_importer(pname, globals, locals, fromlist, level) >>>> ImportError: No module named copy_reg >>>> >>>> I can import copy_reg from the python prompt and adding the import copy >>>> reg from Dal.py (suggested in a thread by Massimo) has no effect. >>>> >>>> I use Python 2.7.8. >>>> >>>> Any clu would be helpfull. >>>> >>>> Richard >>>> >>>> -- 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.