On Dec 31, 2010, at 9:24 PM, Plumo wrote:
> My app uses Google's gdata client library: 
> http://code.google.com/p/gdata-python-client/
> 
> modules/
>   gdata/
>   atom/
>   test.py
> 
> test.py imports gdata, which in turn imports atom. Running test.py directly 
> works fine.
> But within a web2py app I get ImportError: No module named atom
> 
> How can I import this module?
> 

You might try adding your modules directory to sys.path. Something like this:

from gluon.fileutils import abspath
path = abspath('applications', request.application, 'modules')
if path not in sys.path:
        sys.path.append(path)

import_local has explicit knowledge of the modules directory, so it doesn't 
need sys.path. But the import statements in gdata don't.


Alternatively, put gdata and atom in <web2py>/site-packages/, which is already 
in sys.path.

Reply via email to