Google Cloud Function - AttributeError: 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS'

血红的双手。 提交于 2019-12-05 19:42:06

Seems that I found the problem. Which version of Python your pip is using? In my case it was 3.6 despite the fact that the Python itself was 2.7

So the problem was that pip downloaded a Python 3.6 syntax version of httplib2, it was uploaded to the Google App Engine, which use Python 2.7. It tried to load in the module and fail miserably.

Try this :

  1. Check the vesionn of your pip with :

pip -V

If you see some thing like pip 9.0.1 from /bla/bla/lib/python3.6/site-packages (python 3.6) then continue

  1. Install pip for python 2.7 (it should be in the Python2.7 installation pachage under bin folder)

  2. Remove old lib folder in your project

  3. Run pip install -t lib -r requirements.txt (make sure that this pip is the right 2.7 version)

  4. Deploy

By doing that you are using the right version of the lib and it should be working.

Hope it will help.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!