0

I'm trying to sync between python and google drive with the following details:

Authorized JavaScript origins: http://localhost:8080

Authorized redirect URIs: http://localhost:8080/

I copied the json file to the directory and ran this code:

from pydrive.auth import GoogleAuth
gauth = GoogleAuth()
gauth.LocalWebserverAuth()

and I got this error:

from oauth2client.locked_file import LockedFile
ImportError: No module named locked_file

Can you please help me?

Zeehad
  • 1,012
  • 1
  • 9
  • 11
P.Dowsen
  • 3
  • 3

1 Answers1

4

Had the same issue. It looks there was a change in the newest version of the oauth2client, v2.0.0, which broke compatibility with the google-api-python-client module, which now got fixed https://github.com/adrian-the-git/google-api-python-client/commit/2122d3c9b1aece94b64f6b85c6707a42cca8b093, so an upgrade of the google-api-python-client restores compatibility and make everything working again:

$ pip install --upgrade git+https://github.com/google/google-api-python-client
Zoltan Fedor
  • 2,004
  • 2
  • 23
  • 40
  • What exactly does `git+https` do? I have never seen that before. Thank you. – Sabuncu Mar 28 '16 at 20:29
  • As far as I know git+https uses git over https (and not ssh or git directly), which has advantages if you are behind proxy, because git protocol usually doesn't take your proxy settings, but you would need to add specifically - hence I always use git+https when behind the corporate proxy. In your case, you might just use git:// or git+ssh:// or https:// or git+https:// There is a whole discussion on the topic at https://www.reddit.com/r/Python/comments/2crput/how_to_install_with_pip_directly_from_github/, where others claimed that git+https:// is the "official", preferred way. – Zoltan Fedor Mar 28 '16 at 21:21
  • For this to work for us we had to add --target /Library/Python/2.7/site-packages for some reason. – Praxiteles Dec 18 '16 at 22:28