ImportError: No module named httplib2

2019-04-23 14:45发布

I have a Python 2.7 GAE app that already has a lot of functionality. Now I want to integrate with a Google API.

Within my IDE (PyCharm) running on Mac OSX, I added the following lines to my app's main program:

import httplib2
pass

When I COMMAND-click "httplib2", the IDE opens "httplib2-0.8-py2.7.egg/httplib2/init.py" in an editor panel, so the IDE apparently knows where httplib2 is. But running the app, I get the error shown in the title.

To test further, I put breakpoints on both statements shown above and then run the app in debug mode. When it gets to the import statement, I immediately click the "Resume Program" icon.

The console then shows:

ImportError: No module named httplib2

The program then loops. That is, it doesn't terminate, but it never reaches the "pass" statement.

So the IDE seems to know where "httplib2" is, but Python doesn't seem to. Any help on how to get "import httplib2" to succeed will be appreciated. Thanks.

1条回答
小情绪 Triste *
2楼-- · 2019-04-23 15:24

httplib2 is not a standard library that comes with Python, but rather an externally-developed, optional package. If you want it to be available on Google App Engine, you'll have to include it in your application.

查看更多
登录 后发表回答