【问题标题】:'AttributeError: 'module' object has no attribute 'file'' when using oauth2client with Google Calendar'AttributeError: 'module' object has no attribute 'file'' 将 oauth2client 与 Google Calendar 一起使用时
【发布时间】:2016-06-21 04:51:59
【问题描述】:

我正在使用谷歌日历 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)

我在文档中找不到对此类错误的引用。有没有其他人遇到过这种情况?

干杯, 杰克

【问题讨论】:

  • 您可以添加更多代码吗?问题可能在于该部分之前的代码行,即来自 oauth2client 对象或 credential_path 参数的实例化。

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


【解决方案1】:

在原始样本中

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

缺少导入条目:

   from oauth2client import file 

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

【讨论】:

    猜你喜欢
    • 2015-09-26
    • 2014-12-20
    • 1970-01-01
    • 1970-01-01
    • 2022-12-01
    • 2022-12-01
    • 2012-02-29
    • 2013-07-26
    • 2019-12-08
    相关资源
    最近更新 更多