Hi techboy, App Engine uses a custom Python environment, and as such, things like the search path may differ. For example, if you execute "sys.path" on shell.appspot.com, you get:
['/base/python_dist/lib/python25.zip', '/base/python_lib/versions/third_party/django-0.96', '/base/python_dist/lib/python2.5/', '/base/python_dist/lib/python2.5/plat-linux2', '/base/python_dist/lib/python2.5/lib-tk', '/base/python_dist/lib/python2.5/lib-dynload', '/base/python_lib/versions/1', '/base/data/home/apps/shell/1.334417654335420704/'] Note that the app's directory is last in the path, rather than first. -Nick Johnson On Tue, Jul 7, 2009 at 4:28 AM, techboy<scot...@gmail.com> wrote: > > Thanks Nick for your reply. Is the python module search path different > in production, than a standard client install? Because on my local > machine, the current directory is first in the search path, and > "import profile" from within the SDK loads profile.py from my project. > > Thanks again. > > On Jul 6, 2:06 am, "Nick Johnson (Google)" <nick.john...@google.com> > wrote: >> Hitechboy, >> >> It's not a sandboxing issue - it's all down to the Python search path. >> System directories are listed before your own source directories, so >> it searches them first. You can change it by modifying sys.path if you >> wish. >> >> -Nick Johnson >> >> >> >> >> >> On Mon, Jul 6, 2009 at 5:12 AM,techboy<scot...@gmail.com> wrote: >> >> > The problem appears to be that the file in my project is named >> > profile.py. There is also a profile.py in the python distribution >> > itself. >> >> > I'm assuming that it is a sandboxing restriction(?), that I can't >> > import my own profile.py in production (even though it works fine in >> > the dev appserver). >> >> > In production, >> >> > import profile >> > print profile.__file__ >> >> > Shows it is the profile from the python library. >> >> > On Jul 5, 12:29 pm,techboy<scot...@gmail.com> wrote: >> >> I have a webapp.RequestHandler derived class called Profile, in a file >> >> profile.py. It operates correctly locally. When I deploy to >> >> production, it fails. If I simply rename the class to a different >> >> name, it works in production. >> >> >> The logs show this for the failure case. >> >> >> <type 'exceptions.AttributeError'>: Profile instance has no attribute >> >> 'initialize' >> >> Traceback (most recent call last): >> >> <...snip...> >> >> File "/base/python_lib/versions/1/google/appengine/ext/webapp/ >> >> util.py", line 76, in run_wsgi_app >> >> result = application(env, _start_response) >> >> File "/base/python_lib/versions/1/google/appengine/ext/webapp/ >> >> __init__.py", line 491, in __call__ >> >> handler.initialize(request, response) >> >> >> I can work around this problem obviously but I wonder if anyone could >> >> speculate why is happening. >> >> -- >> Nick Johnson, App Engine Developer Programs Engineer >> Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration >> Number: 368047 > > > -- Nick Johnson, App Engine Developer Programs Engineer Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---