Import application from staging to production server

44 views
Skip to first unread message

Anatoli Hristov

unread,
Jan 31, 2017, 8:55:59 PM1/31/17
to web2py-users
Hello,

When I try to import an application I get error. It's my first time that I get this, I imported plenty apps.

Error ticket for "idstock"

Ticket ID

81.164.40.94.2017-01-30.16-32-55.1a6057a7-defb-45ff-af30-25bccb9dbe3e

<type 'exceptions.ImportError'> Cannot import module 'applications.idstock.modules.pkg_resources'

Version

web2py™Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
PythonPython 2.7.9: /usr/bin/python (prefix: /usr)

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
Traceback (most recent call last):
File "/home/idklic/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
File "/home/idklic/web2py/applications/idstock/controllers/default.py", line 10, in <module>
pygal = local_import('pygal')
File "/home/idklic/web2py/gluon/compileapp.py", line 439, in <lambda>
local_import_aux(name, reload, app)
File "/home/idklic/web2py/gluon/compileapp.py", line 347, in local_import_aux
module = __import__(name)
File "/home/idklic/web2py/gluon/custom_import.py", line 108, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
File "applications/idstock/modules/pygal/__init__.py", line 29, in <module>
import pkg_resources
File "/home/idklic/web2py/gluon/custom_import.py", line 89, in custom_importer
raise ImportError, 'Cannot import module %s' % str(e)
ImportError: Cannot import module 'applications.idstock.modules.pkg_resources'

Error snapshot help

<type 'exceptions.ImportError'>(Cannot import module 'applications.idstock.modules.pkg_resources')

Peter

unread,
Nov 19, 2017, 10:03:12 PM11/19/17
to web2py-users

I don't understand the 'local_import'  in this line


pygal = local_import('pygal')

Can't find it in the documentation for web2py, pygal or  searching  python local_import...


but pygal works for me using just...

import pygal

Anthony

unread,
Nov 20, 2017, 11:19:29 AM11/20/17
to web2py-users
On Sunday, November 19, 2017 at 10:03:12 PM UTC-5, Peter wrote:

I don't understand the 'local_import'  in this line

pygal = local_import('pygal')

Can't find it in the documentation for web2py, pygal or  searching  python local_import...

local_import was deprecated after the web2py custom importer was created. It was used as a way to load modules local to the application and allow auto-reloading in development. It still works but is no longer necessary or recommended.

Anthony
Reply all
Reply to author
Forward
0 new messages