1

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 ~/.bashrc on my computer, but I created that and tried to change PATH in both ~/.bash_profile and ~/.bash_profile.pysave. 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 "quickstart.py", line 76, in <module>
    main()
  File "quickstart.py", line 60, in main
    credentials = get_credentials()
  File "quickstart.py", line 48, in get_credentials
    credentials = tools.run_flow(flow, store, flags)
  File "/Library/Python/2.7/site-packages/oauth2client/util.py", line 135, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/oauth2client/tools.py", line 199, in run_flow
    authorize_url = flow.step1_get_authorize_url()
  File "/Library/Python/2.7/site-packages/oauth2client/util.py", line 135, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/oauth2client/client.py", line 2006, 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 490, in _update_query_params
    parts = urllib.parse.urlparse(uri)
AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'urlparse'
Laurel
  • 5,965
  • 14
  • 31
  • 57
gasabr
  • 55
  • 3
  • 9

3 Answers3

0

From this Python issues thread, it's a given workaround to set the system environment variable PYTHONPATH to point directly to pip's install directory and add:

export PYTHONPATH=/Library/Python/2.7/site-packages

which was also suggested in this SO post - Unable to upgrade python six package in mac osx 10.10.2.

I hope that will work on your end.

Community
  • 1
  • 1
Teyam
  • 7,686
  • 3
  • 15
  • 22
0

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

gasabr
  • 55
  • 3
  • 9
0

--ignore-installed six

I had the same problem and this worked for me.

ZeExplorer
  • 543
  • 1
  • 4
  • 18