Reputation: 841
I'm getting the following error message when attempting the Google Drive SDK Quickstart Example (https://developers.google.com/drive/quickstart).
Traceback (most recent call last):
File "quickstart.py", line 6, in <module>
from apiclient.discovery import build
File "build/bdist.macosx-10.6-intel/egg/apiclient/discovery.py", line 45, in <module>
File "build/bdist.macosx-10.6-intel/egg/apiclient/errors.py", line 26, in <module>
ImportError: cannot import name util
As explained in the tutorial, first on my Mac terminal I:
easy_install --upgrade google-api-python-client
I'm using a Mac OS 10.7.4 python 2.7.2
Upvotes: 6
Views: 3719
Reputation: 11167
I recommend using pip
instead of easy_install
. According to this answer to a similar question, it's likely that the Client Library and oauth2client
libraries are incompatible. Best to upgrade both with pip install -U google-api-python-client
(or pip3
for Python 3).
After you get the quickstart working, if you want to see slightly longer, more "real-world" examples of using the Drive API, here are some videos and blog posts I made for you:
(*) - TL;DR: upload plain text file to Drive, import/convert to Google Docs format, then export that Doc as PDF. Post above uses Drive API v2; this follow-up post describes migrating it to Drive API v3, and here's a developer video combining both "poor man's converter" posts.
Upvotes: 2