Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
775 views
in Technique[技术] by (71.8m points)

oauth 2.0 - Attribute Error trying to run Gmail API quickstart in Python

It looks like there might be a version mismatch problem here. How should I go about fixing it?

I've trying updating six with pip, but that doesn't do anything.

Here's the error I see:

Traceback (most recent call last):
  File "./quickstart.py", line 27, in <module>
    credentials = run(flow, STORAGE, http=http)
  File "/Library/Python/2.7/site-packages/oauth2client/util.py", line 137, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/oauth2client/old_run.py", line 120, in run
    authorize_url = flow.step1_get_authorize_url()
  File "/Library/Python/2.7/site-packages/oauth2client/util.py", line 137, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/oauth2client/client.py", line 1827, in step1_get_authorize_url
    return _update_query_params(self.auth_uri, query_params)
  File "/Library/Python/2.7/site-packages/oauth2client/client.py", line 435, in _update_query_params
    parts = urllib.parse.urlparse(uri)
AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'urlparse'
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I ran into a very similar problem, albeit using a completely different API (compute engine). I ended up rolling back the google api client to the previous version - 1.3.2 - as opposed to the latest - 1.4.0. To do this, I ran:

sudo pip install -I google-api-python-client==1.3.2

And was then able to run my code.

I'm not sure if this is the same problem, but it seems to have done the trick for me, hope this helps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...