views:

772

answers:

2

I can run a simple "Hello World" Google App Engine application on localhost with no problems. However, when I add the line "import gdata.auth" to my Python script I get "ImportError: No module named gdata.auth".

I have installed the gdata module and added the following line to my .bashrc:

export PYTHONPATH=$PYTHONPATH:/Library/Python/2.5/site-packages/

Is there anything else I need to do? Thanks.

EDIT: The strange thing is that if I run python from a shell and type "import gdata.auth" I do not get an error.

A: 

try adding this to your script:

import sys
sys.path.append('<directory where gdata.auth module is saved>')
import gdata.auth
ecounysis
I still get the same error. Thanks though.
titaniumdecoy
no I don't think it caused pain - I voted it down because I don't think it answered the question.
Kinlan
+4  A: 

Your .bashrc is not known to Google App Engine. Make sure the gdata directory (with all its proper contents) is under your application's main directory!

See this article, particularly (and I quote):

To use this library with your Google App Engine application, simply place the library source files in your application's directory, and import them as you usually would. The source directories you need to upload with your application code are src/gdata and src/atom. Then, be sure to call the gdata.alt.appengine.run_on_appengine function on each instance of a gdata.service.GDataService object. There's nothing more to it than that!

Alex Martelli
This is how I got it to work the other week for me, just upload the code into a gdata directory and you should be sorted.
Kinlan