Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

A simple way of initializing a pydrive.GoogleDrive object fails when pydrive is replaced by pydrive2 #298

Open
EvanAad opened this issue Aug 14, 2023 · 1 comment
Labels
duplicate This issue or pull request already exists question Further information is requested

Comments

@EvanAad
Copy link

EvanAad commented Aug 14, 2023

The following code works when executed in Google Colab. The code is, in fact, copied from one of the official Google Colab tutorials, the one titled External data: Local Files, Drive, Sheets, and Cloud Storage.

from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials

auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)

However, when pydrive is replaced by pydrive2 in the above listing, and the code is executed in Google Colab, the following error messages result:

---------------------------------------------------------------------------
MessageError                              Traceback (most recent call last)
[<ipython-input-4-3254a9bed9fd>](https://localhost:8080/#) in <cell line: 1>()
----> 1 auth.authenticate_user()
      2 gauth = GoogleAuth()
      3 gauth.credentials = GoogleCredentials.get_application_default()
      4 drive = GoogleDrive(gauth)

2 frames
[/usr/local/lib/python3.10/dist-packages/google/colab/_message.py](https://localhost:8080/#) in read_reply_from_input(message_id, timeout_sec)
    101     ):
    102       if 'error' in reply:
--> 103         raise MessageError(reply['error'])
    104       return reply.get('data', None)
    105 

MessageError: Error: credential propagation was unsuccessful

Why doesn't the code work with pydrive2? Can pydrive2 be made to work with this code? If not, is there a simple alternative?

@shcheklein
Copy link
Member

PTAL here #187

Closing as a duplicate

@shcheklein shcheklein added duplicate This issue or pull request already exists question Further information is requested labels Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants