gasabr gasabr - 1 year ago 219
Python Question

Gmail API Quickstart AttributeError in Python

I'm trying to learn Gmail API with Python using Mac OSX.

I have a standard problem for this OS: the default installation of the "six" module is loaded before the one that pip installed. Google's solution(at the bottom of the page) or this answer don't work.

When I tried to perform Google's one, I haven't found file

on my computer, but I created that and tried to change PATH in both
. It still doesn't help.

What should I do to run the quickstart example on my OS X 10.11.3 with Python 2.7.10 or 3.4.4?

Traceback (most recent call last):
File "", line 76, in <module>
File "", line 60, in main
credentials = get_credentials()
File "", line 48, in get_credentials
credentials = tools.run_flow(flow, store, flags)
File "/Library/Python/2.7/site-packages/oauth2client/", line 135, in positional_wrapper
return wrapped(*args, **kwargs)
File "/Library/Python/2.7/site-packages/oauth2client/", line 199, in run_flow
authorize_url = flow.step1_get_authorize_url()
File "/Library/Python/2.7/site-packages/oauth2client/", line 135, in positional_wrapper
return wrapped(*args, **kwargs)
File "/Library/Python/2.7/site-packages/oauth2client/", line 2006, in step1_get_authorize_url
return _update_query_params(self.auth_uri, query_params)
File "/Library/Python/2.7/site-packages/oauth2client/", line 490, in _update_query_params
parts = urllib.parse.urlparse(uri)
AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'urlparse'

Answer Source

Solution i have found: Reinstall Python 2.7, restart terminal.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download