Problems loading libraries

80 views
Skip to first unread message

Jesús Espejo

unread,
Jan 17, 2013, 2:25:35 PM1/17/13
to google-a...@googlegroups.com
Hello,

Since 2 days i'm experimenting issues when i load my own libraries (libraries created by myself and used in mi app):
Traceback (most recent call last):
  File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 196, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 255, in _LoadHandler
    handler = __import__(path[0])
  File "/base/data/home/apps/s~37c2b5db880b7a17476582a0fb597b/1.364655963966448445/webHandler.py", line 15, in <module>
    from lib.userLib import adminUser
  File "/base/data/home/apps/s~37c2b5db880b7a17476582a0fb597b/1.364655963966448445/lib/userLib/adminUser.py", line 15, in <module>
    import common as CU
  File "/base/data/home/apps/s~37c2b5db880b7a17476582a0fb597b/1.364655963966448445/lib/userLib/common.py", line 16, in <module>
    import normalUser
  File "/base/data/home/apps/s~37c2b5db880b7a17476582a0fb597b/1.364655963966448445/lib/userLib/normalUser.py", line 16, in <module>
    from lib import common, city, images, sport, club
  File "/base/data/home/apps/s~37c2b5db880b7a17476582a0fb597b/1.364655963966448445/lib/club.py", line 18, in <module>
    from lib.userLib import common as CU
ImportError: cannot import name common

Sometimes it works, sometimes it doesn't work... What is the reason? For the same version and without deploying new code, sometimes it works, sometime it doesn't...

Thanks in advance,
Jesús.

Guido van Rossum

unread,
Jan 17, 2013, 2:27:49 PM1/17/13
to google-a...@googlegroups.com
Usually this is because you are setting sys.path to point to the
libraries, but you have an entry point in your app.yaml that doesn't
invoke the code that sets sys.path. One solution is to put the
sys.path-setting code in appengine_config.py.
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/TmE90_U3WAUJ.
> To post to this group, send email to google-a...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengi...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.



--
--Guido van Rossum (python.org/~guido)

Jesús Espejo

unread,
Jan 17, 2013, 2:31:50 PM1/17/13
to google-a...@googlegroups.com, gu...@python.org
But... How i can do it? There is some documents which explain that in the official app engine's documentation?

Thanks again!

Jesús Espejo

unread,
Jan 17, 2013, 2:40:33 PM1/17/13
to google-a...@googlegroups.com, gu...@python.org
Ok, i have found all information here: https://developers.google.com/appengine/articles/deferred?hl=en

Thanks for the details!


El jueves, 17 de enero de 2013 20:27:49 UTC+1, Guido van Rossum escribió:

Jesús Espejo

unread,
Jan 17, 2013, 3:31:22 PM1/17/13
to google-a...@googlegroups.com
Even when i add to my path, it fails :-/. 

I'm showing the path and the libs are included:

['/base/data/home/apps/s~37c2b5db880b7a17476582a0fb597b/1.364657294245293293', '/python27_runtime/python27_dist/lib/python27.zip', '/python27_runtime/python27_dist/lib/python2.7', '/python27_runtime/python27_dist/lib/python2.7/plat-linux2', '/python27_runtime/python27_dist/lib/python2.7/lib-tk', '/python27_runtime/python27_dist/lib/python2.7/lib-old', '/python27_runtime/python27_dist/lib/python2.7/lib-dynload', '/python27_runtime/python27_dist/lib/python2.7/site-packages', '/python27_runtime/python27_lib/versions/1', '/python27_runtime/python27_lib/versions/third_party/jinja2-2.6', '/python27_runtime/python27_lib/versions/third_party/markupsafe-0.15', '/python27_runtime/python27_lib/versions/third_party/setuptools-0.6c11', '/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2', '/python27_runtime/python27_lib/versions/third_party/webob-1.1.1', '/python27_runtime/python27_lib/versions/third_party/yaml-3.10', '/base/data/home/apps/s~37c2b5db880b7a17476582a0fb597b/1.364657294245293293/lib', '/base/data/home/apps/s~37c2b5db880b7a17476582a0fb597b/1.364657294245293293/lib/userLib', '/base/data/home/apps/s~37c2b5db880b7a17476582a0fb597b/1.364657294245293293/lib/apis', '/base/data/home/apps/s~37c2b5db880b7a17476582a0fb597b/1.364657294245293293/pytz']

Why it still continues failing? :-/

Guido van Rossum

unread,
Jan 17, 2013, 3:43:07 PM1/17/13
to google-a...@googlegroups.com
Recursive imports? Missing __init__.py?
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/I-Y7zvcZUEoJ.

Jesús Espejo

unread,
Jan 17, 2013, 3:47:13 PM1/17/13
to google-a...@googlegroups.com, gu...@python.org
Hello,

Recursive imports means "libraries inside libraries"? I have lib as library, and inside it i have another library called "userLib". That's a problem...? I will try to move to different folders...

Guido van Rossum

unread,
Jan 17, 2013, 3:48:41 PM1/17/13
to Jesús Espejo, google-a...@googlegroups.com
Either that, or A imports B imports C imports A.

I recommend that you try to understand how sys.path and imports work
in a smaller example first, before creating something as complex as
what you apparently have. :-)

Jesús Espejo

unread,
Jan 17, 2013, 3:55:18 PM1/17/13
to google-a...@googlegroups.com, Jesús Espejo, gu...@python.org
Aha...! That is, for sure. I will check all my imports. 

Thank you a lots!
Reply all
Reply to author
Forward
0 new messages