python - '属性错误 : 'module' object has no attribute 'file' ' when using oauth2client with Google Calendar

标签 python calendar oauth-2.0 google-calendar-api oauth2client

我正在使用 google calendars python api ( https://developers.google.com/google-apps/calendar/quickstart/python#step_3_set_up_the_sample ) 的示例脚本来尝试打印出所有日历事件。但是我收到以下错误:

AttributeError: 'module' object has no attribute 'file'

来自行

store = oauth2client.file.Storage(credential_path)

我在文档中找不到对此类错误的引用。有没有其他人以前遇到过这个问题?

干杯, jack

最佳答案

在原始样本中

https://developers.google.com/google-apps/calendar/quickstart/python#step_3_set_up_the_sample

缺少导入条目:

   from oauth2client import file 

添加这一行并尝试再次运行您的脚本

关于python - '属性错误 : 'module' object has no attribute 'file' ' when using oauth2client with Google Calendar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37002110/

相关文章:

python - 如何制作一个 Python 程序来演示 Zipf 定律?

python - 如何将字典转换为 Python 中的字典列表?

java - 如何检测何时单击(选择)jsp 日历中的某一天并执行某些操作?

django - 使用 Django Oauth Toolkit 获取 token

ruby-on-rails - rails api 和 node.js 应用程序之间的用户身份验证

python - 使用 Python 从 C/C++ DLL 调用方法

php - 在日历中显示事件 php mysql

java - 用于显示时间表/日历/议程的 JSF 组件

reactjs - 从身份服务器登录页面启动授权代码流的正确方法是什么?

python - Keras VGG 模型中 preprocess_input() 函数的作用是什么?