Attribute Error trying to run Gmail API quickstart in Python Attribute Error trying to run Gmail API quickstart in Python python python

Attribute Error trying to run Gmail API quickstart in Python


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.


Figured out the source of the problem -- the pre-installed OSX version of six (1.4.1) is the one loaded because its location comes first on your python path.

The version required by gmail (1.6.1) is therefore shielded and therefore never imported.

A quick fix is just to prepend the 1.6.1 installation directory to your python path, so it's loaded before the 1.4.1 version. Not the best solution, but it works.

import syssys.path.insert(1, '/Library/Python/2.7/site-packages')