获取AttributeError:运行Google Sheets API快速入门时,“模块"对象没有属性"DEFAULT_MAX_REDIRECTS" [英] Getting AttributeError: 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS' when running Google Sheets API quickstart

查看:84
本文介绍了获取AttributeError:运行Google Sheets API快速入门时,“模块"对象没有属性"DEFAULT_MAX_REDIRECTS"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在遵循本指南 https://developers.google.com/sheets /api/quickstart/python

运行它们提供的示例代码后(我唯一更改的是api机密的位置,因为我们已经进行了设置,并且APPLICATION_NAME已经存在)

Upon running the sample code they provided (The only thing I changed was the location of the api secret since we already had one set up and the APPLICATION_NAME) I get this error

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库的通用名称.

I got the same error and investigated on the problem.
In my case, it was caused by a file named ''calendar.py" in the same directory.
It's said you should avoid using general names that can be used for standard python library.

这篇关于获取AttributeError:运行Google Sheets API快速入门时,“模块"对象没有属性"DEFAULT_MAX_REDIRECTS"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆