我正在遵循本指南https://developers.google.com/sheets/api/quickstart/python https://developers.google.com/sheets/api/quickstart/python
运行他们提供的示例代码后(我唯一更改的是 api 密钥的位置,因为我们已经设置了一个密钥和 APPLICATION_NAME),我收到此错误
AttributeError: 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS'
错误发生前的日志
File "generate_report.py", line 2, in <module>
import httplib2
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/httplib2/__init__.py", line 42, in <module>
import calendar
File "/Users/HarshaGoli/Git/PantherBot/scripts/calendar.py", line 1, in <module>
from oauth2client.service_account import ServiceAccountCredentials
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/service_account.py", line 25, in <module>
from oauth2client import client
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/client.py", line 39, in <module>
from oauth2client import transport
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client/transport.py", line 255, in <module>
redirections=httplib2.DEFAULT_MAX_REDIRECTS,
我遇到了同样的错误并调查了该问题。
就我而言,这是由同一目录中名为“calendar.py”的文件引起的。
据说您应该避免使用可用于标准 python 库的通用名称。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)