python - PYTHONPATH conflict -
i trying import zipcodedatabase
in helloworld.py
.
helloworld.py
exists @/google-app-engine/helloworld
zipcodedatabase
module exists/usr/local/lib/python/python2.7/dist-packages
pythonpath
=/usr/local/lib/python/python2.7/dist-packages;/usr/local/lib/python/
when compiling helloworld
still getting "zipcodedatabase
module not found". why isn't being picked pythonpath
?
i highly doubt you've got module called zipcodedatabase
. naming convention typically reserved class
resides within module
. modules lowercase or lower_snake_case, represent file containing module. i'm assuming you've installed pyzipcode
here, may different module.
# assuming pyzipcode.py in dist-packages directory $ python -c 'from pyzipcode import zipcodedatabase'
if i'm wrong above, sure you're running version of python has zipcodedatabase module installed?
some troubleshooting steps:
$ python $ python --version $ python -c 'import zipcodedatabase' $ ls -l /usr/local/lib/python2.7/dist-packages/ | grep -i zip
also, necessary specify pythonpath
line? typically, site-packages
folder (and extension assume dist-packages
folder on ubuntu) included in default pythonpath
, along current directory of python module you're using.
how did install zipcodedatabase? did drop file in there? try putting alongside helloworld.py
file , try importing then. also, full stack trace useful information here, when others trying diagnose problem you're having.
edit:
ok, know you're using google app engine (should have been obvious use of paths - i'm sorry), looks doesn't use site-packages
or dist-packages
load modules. should create sub-directory in project relevant third party libraries, , add sub-directory path. disclaimer: i've never used gae might missing mark this.
check out this answer how structure project , add directory path within application.
Comments
Post a Comment