Import error when module is already in sys.path
It's strange to me that the import fails even when it's in sys.path
.
today, I have installed django environment for google app on ubuntu in my lab pc. And it works great when I checked the code and ran it in windows (same computer in the lab).
But when I went to the dorm and checked the code and started working, it was weird.
I am typing sys.path
for example:
['/home/tower/googlecode/mygae', '/home/tower/googlecode/mygae/.google_appengine', '/home/tower/googlecode/mygae/.google_appengine/lib/antlr3', ...]
and when i ran python complained
from google.appengine.api import apiproxy_stub_map
ImportError: No module named appengine.api
it is easy to find out that the google module is in the '/home/tower/googlecode/mygae/.google_appengine'
directory and __init__.py
for each module.
And what could be causing this strange thing? Or perhaps what I messed up?
thank.
source to share
I had the same problem on Ubuntu when I wanted to play with google.appengine in the console. I first tried to fix this by removing the package /usr/lib/python2.7/dist-packages/google
altogether, but Ubuntu One . Finally I solved it by bundling the google GAE SDK into the package that caused the collision .
The contents of the directory /usr/lib/python2.7/dist-packages/google
now look like this:
/google /appengine /net /protobuf /pyglib /storage /__init__.py /__init__.pyc
source to share