Gmail API Python快速入门gmail-python-quickstart.json:没有这样的文件或目录

时间:2016-11-29 18:38:10

标签: python json python-2.7 gmail-api

我试图在此处执行此示例:第3步@ Gmail API Python Quickstart 我有两个错误,并得到了他们

  1. 无法取消现有的6个版本 - 将其设置为

    --ignore-installed six

  2. 无法找到httplib2 - 通过执行特定的

    来解决问题

    pip2 install httplib2

  3. 现在当我进入client_secret.json&的工作目录时找到quickstart.py并执行python quickstart.py我收到了以下错误。任何想法如何让这个代码执行。

    bash-3.2$ python quickstart.py 
    /Library/Python/2.7/site-packages/oauth2client/_helpers.py:255: UserWarning: Cannot access /Users/Zafar/.credentials/gmail-python-quickstart.json: No such file or directory
      warnings.warn(_MISSING_FILE_MESSAGE.format(filename))
    Traceback (most recent call last):
      File "quickstart.py", line 73, in <module>
        main()
      File "quickstart.py", line 57, in main
        credentials = get_credentials()
      File "quickstart.py", line 45, in get_credentials
        credentials = tools.run_flow(flow, store, flags)
      File "/Library/Python/2.7/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
        return wrapped(*args, **kwargs)
      File "/Library/Python/2.7/site-packages/oauth2client/tools.py", line 218, in run_flow
        authorize_url = flow.step1_get_authorize_url()
      File "/Library/Python/2.7/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
        return wrapped(*args, **kwargs)
      File "/Library/Python/2.7/site-packages/oauth2client/client.py", line 1934, in step1_get_authorize_url
        return _helpers.update_query_params(self.auth_uri, query_params)
      File "/Library/Python/2.7/site-packages/oauth2client/_helpers.py", line 222, in update_query_params
        parts = urllib.parse.urlparse(uri)
    AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'urlparse'
    

1 个答案:

答案 0 :(得分:1)

我刚遇到同样的问题。 您需要创建该文件并将其命名为gmail-python-quickstart.json。