gpt4 book ai didi

google-app-engine - 谷歌云功能 - AttributeError : 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS'

转载 作者:太空宇宙 更新时间:2023-11-03 15:31:59 25 4
gpt4 key购买 nike

我正在使用 Appengine cron 作业来安排云功能,当我部署并尝试运行作业时,出现以下错误。知道这里有什么问题吗?按照[此处][1]中的步骤

(/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py:263)
Traceback (most recent call last):
File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/base/data/home/apps/s~zion-hymns/20180222t221057.407849847593018575/main.py", line 18, in <module>
import pubsub_utils
File "/base/data/home/apps/s~zion-hymns/20180222t221057.407849847593018575/pubsub_utils.py", line 24, in <module>
import oauth2client.contrib.appengine as gae_oauth2client
File "./lib/oauth2client/contrib/appengine.py", line 36, in <module>
from oauth2client import client
File "./lib/oauth2client/client.py", line 39, in <module>
from oauth2client import transport
File "./lib/oauth2client/transport.py", line 255, in <module>
redirections=httplib2.DEFAULT_MAX_REDIRECTS,
AttributeError: 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS'


[1]: https://firebase.googleblog.com/2017/03/how-to-schedule-cron-jobs-with-cloud.html?utm_campaign=culture_education_functions_en_06-29-17&utm_source=Firebase&utm_medium=yt-desc

最佳答案

看来我发现了问题。您的 pip 使用的是哪个版本的 Python?在我的例子中它是 3.6 尽管 Python 本身是 2.7

所以问题是 pip 下载了 httplib2Python 3.6 语法版本,它被上传到 Google App Engine,它使用 python 2.7。它试图加载模块并惨遭失败。

试试这个:

  1. 检查你的 pip 版本:

pip -V

如果您从 /bla/bla/lib/python3.6/site-packages (python 3.6) 看到类似 pip 9.0.1 的内容,则继续

  1. 安装python 2.7的pip(应该在python2.7安装包的bin文件夹下)

  2. 删除项目中的旧 lib 文件夹

  3. 运行 pip install -t lib -r requirements.txt(确保这个 pip 是正确的 2.7 版本)

  4. 部署

通过这样做,您使用的是正确版本的库,它应该可以正常工作。

希望对您有所帮助。

关于google-app-engine - 谷歌云功能 - AttributeError : 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48941042/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com