我试图在此处执行此示例:第3步@ Gmail API Python Quickstart 我有两个错误,并得到了他们
无法取消现有的6个版本 - 将其设置为
--ignore-installed six
无法找到httplib2 - 通过执行特定的
来解决问题 pip2 install httplib2
现在当我进入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'
答案 0 :(得分:1)
我刚遇到同样的问题。 您需要创建该文件并将其命名为gmail-python-quickstart.json。