Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

PyDrive not working with oauth2client version 4.0 #78

Closed
dwai1714 opened this issue Oct 16, 2016 · 13 comments
Closed

PyDrive not working with oauth2client version 4.0 #78

dwai1714 opened this issue Oct 16, 2016 · 13 comments
Assignees
Labels
Milestone

Comments

@dwai1714
Copy link

oauth2client.file.CredentialsFileSymbolicLinkError not found error

@RNabel
Copy link
Collaborator

RNabel commented Oct 17, 2016

Thank you for posting this here :)

Could you please post instructions on how to reproduce the error, and a traceback?

@purbayasetiya
Copy link

purbayasetiya commented Oct 18, 2016

Hey, i also have the same problem. At the beginning i try to run the code on windows, and it worked. But when i try to run the code on my raspberry pi (OS raspbian) the code show me error about symboliclink.

i run this code

from pydrive.auth import GoogleAuth

gauth = GoogleAuth()
gauth.LocalWebserverAuth()

import error : oauth2client.file.CredentialsFileSymbolicLinkError not found error
the error is from auth.py line 15 which is "from oauth2client.file import CredentialsFileSymbolicLinkError"

i follow the same instruction on authentication page auth page when i try on windows and raspbian.

@RNabel RNabel added the bug label Oct 18, 2016
@RNabel RNabel self-assigned this Oct 18, 2016
@RNabel
Copy link
Collaborator

RNabel commented Oct 18, 2016

@purbayasetiya Thank you for the details!

The problem is that PyDrive relies on google-api-python-client which in turn relies on oauth2client.
Now PyDrive gets its version of oauth2client from the google-api-python-client, but is not compatible with 4.0.0 (which you can tell by the semantic versioning is not necessarily backwards compatible with 3.x.x).

PyDrive now needs to be compatible with oauth2client 4.0.0. If either of you, @purbayasetiya and @dwai1714, need this urgently, replace lines 307-311 in auth.py with:

try:
      storage = Storage(credentials_file)
      self.credentials = storage.locked_get()
  except IOError:
      raise InvalidCredentialsError('Credentials file cannot be symbolic link')

and remove line 15:

from oauth2client.file import CredentialsFileSymbolicLinkError

I have not tested this yet. Let me know how you get on!

@dwai1714
Copy link
Author

Hi Robin 
Thank you very much. For the time being I made it backward compatible. Once you update the package I will update my project.On a separate note if we move to google API version 3, do we need changes. If thats the case I will be happy to contribute.Apologies, you made PyDrive so simple that I did not peek inside too much :)
ThanksDC 

  From: Robin Nabel <[email protected]>

To: googledrive/PyDrive [email protected]
Cc: DC [email protected]; Mention [email protected]
Sent: Tuesday, October 18, 2016 2:58 PM
Subject: Re: [googledrive/PyDrive] PyDrive not working with oauth2client version 4.0 (#78)

@purbayasetiya Thank you for the details!The problem is that PyDrive relies on google-api-python-client which in turn relies on oauth2client.
Now PyDrive gets its version of oauth2client from the google-api-python-client, but is not compatible with 4.0.0 (which you can tell by the semantic versioning is not necessarily backwards compatible with 3.x.x).So, basically, PyDrive needs to compatible with oauth2client 4.0.0. If either of you, @purbayasetiya and @dwai1714, need this urgently, replace lines 307-311 in auth.py with:try:
storage = Storage(credentials_file)
self.credentials = storage.locked_get()
except IOError:
raise InvalidCredentialsError('Credentials file cannot be symbolic link')and remove line 15:from oauth2client.file import CredentialsFileSymbolicLinkError—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@keliomer
Copy link

keliomer commented Oct 18, 2016

Related - Getting below when trying to run anything out of pydrive.auth

File "C:\Python27\lib\site-packages\pydrive\auth.py", line 17, in <module> from oauth2client.util import scopes_to_string ImportError: No module named util

Based on discussion on the pydrive issues forum util has been merged into the "private" _helpers module.

editing the auth file to read

from oauth2client._helpers import scopes_to_string

seems to fix the issue

@keliomer
Copy link

Status update? I know the IOError replacement is only a stop-gap. What needs to be checked for oauth2client 4.0.0 compatibility from a testing standpoint?

@fauzanzaid
Copy link

fauzanzaid commented Oct 22, 2016

The current pydrive seems to be compatible with this older google api python client package. I've not tested though.

@RNabel
Copy link
Collaborator

RNabel commented Oct 23, 2016

Quick update: The plan is to add the oauth dependency explicitly to setup.py*, fix incompatibilities until all tests pass. I will not be able to do this in the next days.
@keliomer, the testing setup should not need to be changed - all tests should be run in a clean virtual environment with the library (and all of its dependencies) installed.

If any of you have time to fix these errors (which would be amazing), I will review PRs asap (<24hrs).

*i.e. in setup.py:

setup(
    ...
    install_requires=[
        "google-api-python-client >= 1.2",
        "oauth2client >= 4.0.0",  # This line needs to be added.
        "PyYAML >= 3.0",
    ],
    ...
)

@RNabel RNabel added this to the Next Release milestone Oct 23, 2016
@keliomer
Copy link

PR here

@RNabel
Copy link
Collaborator

RNabel commented Oct 24, 2016

@keliomer thank you so much for the PR. I have reviewed and merged it (although GitHub doesn't seem to recognize it 😞). I'll leave this issue open until the new version is pushed to PyPI.

@RNabel
Copy link
Collaborator

RNabel commented Oct 24, 2016

Alright, the new version is live on PyPI - crises averted. Thank you again for all of your input!

@RNabel RNabel closed this as completed Oct 24, 2016
@dwai1714
Copy link
Author

This works great now.
Thanks a lot.

@hamza-carameltech
Copy link

File "/opt/python/run/venv/lib/python2.7/site-packages/pydrive/auth.py", line 224, in LocalWebserverAuth
[Fri Oct 06 06:56:53.809651 2017] [:error] [pid 21696] raise AuthenticationError()
[Fri Oct 06 06:56:53.809653 2017] [:error] [pid 21696] AuthenticationError
[Fri Oct 06 06:57:11.600320 2017] [:error] [pid 21696] Failed to start a local web server. Please check your firewall
[Fri Oct 06 06:57:11.600350 2017] [:error] [pid 21696] settings and locally running programs that may be blocking or
[Fri Oct 06 06:57:11.600355 2017] [:error] [pid 21696] using configured ports. Default ports are 8080 and 8090.
anyone know how to resolve this issue?

inderpreet99 added a commit to inderpreet99/cumulus-tv-m3u8-loader that referenced this issue Nov 4, 2017
Link googlearchive/PyDrive#78
Fixes `ImportError: cannot import name CredentialsFileSymbolicLinkError`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants