Google API Python - KeyError:_module

时间:2016-12-04 12:22:41

标签: python oauth-2.0 google-api google-oauth2

我正在尝试使用oauth2按照Google的Gmail API使用quickstart.py(https://developers.google.com/gmail/api/quickstart/python)。我收到以下错误。

Traceback (most recent call last):
  File "quickstart.py", line 68, in <module>
    main()
  File "quickstart.py", line 54, in main
    credentials = get_credentials()
  File "quickstart.py", line 37, in get_credentials
    credentials = store.get()
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 407, in get
        return self.locked_get()
      File "/usr/local/lib/python2.7/dist-packages/oauth2client/file.py", line 54, in locked_get
        credentials = client.Credentials.new_from_json(content)
      File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 302, in new_from_json
        module_name = data['_module']
    KeyError: '_module'

1 个答案:

答案 0 :(得分:1)

对我来说,我以为storage.json应该是包含某些内容的文件,但是应该只是Python脚本可以保存数据的文件名。因此,一旦我给它提供了一个不存在的文件的路径,它就会起作用。