iterative / iterative/PyDrive2

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

Aperta
#298 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
duplicate question
Lingua principale
Python
Stelle
670
Fork
75
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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](https://colab.research.google.com/notebooks/io.ipynb?hl=en#scrollTo=7taylj9wpsA2).

```
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)
[](https://localhost:8080/#) in ()
----> 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?

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

No repository file, test, or entry point is named in the issue. First reproduce the credential-propagation error in Google Colab while comparing the pydrive and pydrive2 setup; done means identifying whether the failure is caused by PyDrive2 and documenting a working initialization or simple alternative.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
api, cloud
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.