I'm not using setup.py install but rather have the gdata and atom package inside a third-party directory for my application.
Importing the atom package works fine. For example: from vendor.google import atom
But when I try: from vendor.google import gdata
I get an import error: ImportError('No module named atom')
The problem is line 27 of the gdata package's __init__ file: import atom
What I don't understand is that even if I explicitly add the package's directory to sys.path, I still encounter the error. For example, this is ok: sys.path.append('<BASEPATH>/vendor') import google
But the following will raise the error: sys.path.append('<BASEPATH>/vendor/google') import atom # or: import gdata
I've exhausted all my avenues. What am I missing? Help appreciated, Tom
I think sys.path.append should be a viable option, what are you using for the string? If you placed the gdata and atom directories under vendor/google in your project, then you should be able to add this to the path like this:
sys.path.append('vendor/google')
The above would work assuming that your directory structure is like this
> I'm not using setup.py install but rather have the gdata and atom > package inside a third-party directory for my application.
> Importing the atom package works fine. For example: > from vendor.google import atom
> But when I try: > from vendor.google import gdata
> I get an import error: > ImportError('No module named atom')
> The problem is line 27 of the gdata package's __init__ file: > import atom
> What I don't understand is that even if I explicitly add the package's > directory to sys.path, I still encounter the error. For example, this > is ok: > sys.path.append('<BASEPATH>/vendor') > import google
> But the following will raise the error: > sys.path.append('<BASEPATH>/vendor/google') > import atom # or: import gdata
> I've exhausted all my avenues. What am I missing? Help appreciated, > Tom
> I think sys.path.append should be a viable option, what are you using > for the string? If you placed the gdata and atom directories under > vendor/google in your project, then you should be able to add this to > the path like this:
> sys.path.append('vendor/google')
> The above would work assuming that your directory structure is like > this
> On Jan 30, 12:36 pm, klenwell <klenw...@gmail.com> wrote:
> > I'm not using setup.py install but rather have the gdata and atom > > package inside a third-party directory for my application.
> > Importing the atom package works fine. For example: > > from vendor.google import atom
> > But when I try: > > from vendor.google import gdata
> > I get an import error: > > ImportError('No module named atom')
> > The problem is line 27 of the gdata package's __init__ file: > > import atom
> > What I don't understand is that even if I explicitly add the package's > > directory to sys.path, I still encounter the error. For example, this > > is ok: > > sys.path.append('<BASEPATH>/vendor') > > import google
> > But the following will raise the error: > > sys.path.append('<BASEPATH>/vendor/google') > > import atom # or: import gdata
> > I've exhausted all my avenues. What am I missing? Help appreciated, > > Tom
Google offers a Google Data Python client library that simplifies token management and requesting data from specific Google Data APIs. We recently released a version of this library that supports making requests from Google App Engine applications. In this article we'll use this library, but of course you're welcome to use whatever works best for your application. Download the gdata-python-client library.
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!"
On Feb 7, 12:32 pm, klenwell <klenw...@gmail.com> wrote:
> If I put gdata and atom in app's root directory (parallel to > app.yaml), they are imported without incident.
> Is there a rational explanation for this? Could it have something to > do with the fact that the __init__.py files in gdata and atom aren't > empty?
> Tom
> On Feb 4, 10:53 am, Jeff S <j...@google.com> wrote:
> > Hi Tom,
> > I think sys.path.append should be a viable option, what are you using > > for the string? If you placed the gdata and atom directories under > > vendor/google in your project, then you should be able to add this to > > the path like this:
> > sys.path.append('vendor/google')
> > The above would work assuming that your directory structure is like > > this
> > On Jan 30, 12:36 pm, klenwell <klenw...@gmail.com> wrote:
> > > I'm not using setup.py install but rather have the gdata and atom > > > package inside a third-party directory for my application.
> > > Importing the atom package works fine. For example: > > > from vendor.google import atom
> > > But when I try: > > > from vendor.google import gdata
> > > I get an import error: > > > ImportError('No module named atom')
> > > The problem is line 27 of the gdata package's __init__ file: > > > import atom
> > > What I don't understand is that even if I explicitly add the package's > > > directory to sys.path, I still encounter the error. For example, this > > > is ok: > > > sys.path.append('<BASEPATH>/vendor') > > > import google
> > > But the following will raise the error: > > > sys.path.append('<BASEPATH>/vendor/google') > > > import atom # or: import gdata
> > > I've exhausted all my avenues. What am I missing? Help appreciated, > > > Tom
Looks to me like the gdata and atom directories need to go directly into the root of your app. Then you will be able to use import statements like 'import gdata.docs.service' or whatever you need from there.
On Feb 7, 12:32 pm, klenwell <klenw...@gmail.com> wrote:
> If I put gdata and atom in app's root directory (parallel to > app.yaml), they are imported without incident.
> Is there a rational explanation for this? Could it have something to > do with the fact that the __init__.py files in gdata and atom aren't > empty?
> Tom
> On Feb 4, 10:53 am, Jeff S <j...@google.com> wrote:
> > Hi Tom,
> > I think sys.path.append should be a viable option, what are you using > > for the string? If you placed the gdata and atom directories under > > vendor/google in your project, then you should be able to add this to > > the path like this:
> > sys.path.append('vendor/google')
> > The above would work assuming that your directory structure is like > > this
> > On Jan 30, 12:36 pm, klenwell <klenw...@gmail.com> wrote:
> > > I'm not using setup.py install but rather have the gdata and atom > > > package inside a third-party directory for my application.
> > > Importing the atom package works fine. For example: > > > from vendor.google import atom
> > > But when I try: > > > from vendor.google import gdata
> > > I get an import error: > > > ImportError('No module named atom')
> > > The problem is line 27 of the gdata package's __init__ file: > > > import atom
> > > What I don't understand is that even if I explicitly add the package's > > > directory to sys.path, I still encounter the error. For example, this > > > is ok: > > > sys.path.append('<BASEPATH>/vendor') > > > import google
> > > But the following will raise the error: > > > sys.path.append('<BASEPATH>/vendor/google') > > > import atom # or: import gdata
> > > I've exhausted all my avenues. What am I missing? Help appreciated, > > > Tom