3
votes

I'm following the sample python code for the quickstart page of Google Drive SDK (https://developers.google.com/drive/quickstart#set_up_the_sample) and get the error

Traceback (most recent call last):
  File "quickstart.py", line 45, in <module>
    file = drive_service.files().insert(body=body, media_body=media_body).execute()
  File "build/bdist.macosx-10.7-intel/egg/oauth2client/util.py", line 120, in positional_wrapper
  File "build/bdist.macosx-10.7-intel/egg/apiclient/http.py", line 656, in execute
  File "build/bdist.macosx-10.7-intel/egg/oauth2client/util.py", line 120, in positional_wrapper
  File "build/bdist.macosx-10.7-intel/egg/apiclient/http.py", line 733, in next_chunk
apiclient.errors.ResumableUploadError: Failed to retrieve starting URI.

after entering the verification code. The steps are fairly straight forward so I'm wondering if the sample code is out of date (although I haven't seen other people running into this error so it seems it might be something related to my setup, but I'm not sure what that would be). Thanks for any help.

3
Does the code run on a different machine? as a different user? in a clean virtualenv? Possibly a network error, so double-check firewalls, proxy settings, blacklists, etc. - Ben Graham
Sample code is accurate, I just tried it today. You could check you have an up-to-date library installed? - Ali Afshar

3 Answers

3
votes

To expand on papahoolio's answer:

You need to make sure the service is enabled, but there's a gotcha: There's both a "Drive SDK" and a "Drive API" service, and only the latter ("Drive API") will work. However, the former has the nice Drive icon, and if you're like me, you tunnel-visioned it.

To enable:

0
votes

In the Google API console there are two services relating to drive development, SDK and API. Make sure Drive API is on

0
votes

I ran into this issue with the corporate version of Google Drive. When running against the non-business Google Drive, the sample code worked fine. The oauth was being blocked by corporate policies.