Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

colab TypeError: GoogleAuth.LocalWebserverAuth() takes from 1 to 3 positional arguments but 5 were given #347

Open
casesolved-co-uk opened this issue May 11, 2024 · 1 comment

Comments

@casesolved-co-uk
Copy link

casesolved-co-uk commented May 11, 2024

I don't understand this error I'm getting on a local google colab docker runtime.
I've checked the code and LocalWebserverAuth takes 4 parameters??

TypeError                                 Traceback (most recent call last)

[<ipython-input-37-7bae651e2bc5>](https://localhost:8080/#) in <cell line: 9>()
      7 gauth = GoogleAuth(settings_file='settings.yaml')
      8 #gauth.credentials = GoogleCredentials.get_application_default()
----> 9 gauth.LocalWebserverAuth('localhost', [8090], False, '172.17.0.2')
     10 #gauth.CommandLineAuth()  # requires urn:ietf:wg:oauth:2.0:oob, no longer supported
     11 drive = GoogleDrive(gauth)

1 frames

[/usr/local/lib/python3.10/dist-packages/google/colab/_import_hooks/_pydrive2.py](https://localhost:8080/#) in PatchedLocalWebServerAuth(self, *args, **kwargs)
     59             self.credentials.refresh(httplib2.Http())
     60             return
---> 61           return orig_local_webserver_auth(self, *args, **kwargs)
     62 
     63         pydrive_auth_module.GoogleAuth.LocalWebserverAuth = (

[/usr/local/lib/python3.10/dist-packages/pydrive2/auth.py](https://localhost:8080/#) in _decorated(self, *args, **kwargs)
    123             self.LoadCredentials()
    124         if self.flow is None:
--> 125             self.GetFlow()
    126         if self.credentials is None:
    127             code = decoratee(self, *args, **kwargs)

TypeError: GoogleAuth.LocalWebserverAuth() takes from 1 to 3 positional arguments but 5 were given

Info:
Name: PyDrive2
Version: 1.19.0
Summary: Google Drive API made easy. Maintained fork of PyDrive.
Home-page: https://github.com/iterative/PyDrive2
Author: JunYoung Gwak
Author-email: jgwak@dreamylab.com
License: Apache License 2.0
Location: /usr/local/lib/python3.10/dist-packages
Requires: google-api-python-client, oauth2client, pyOpenSSL, PyYAML

@casesolved-co-uk
Copy link
Author

Okay looks like Google Colab monkey patches the pydrive2 LocalWebserver and expects an old version (1.6.3 I think) which doesn't have the same function spec:

google/colab/_import_hooks/_pydrive2.py

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant