我有一个colab笔记本存储在共享的Google驱动器中。想法是与其他gsuite用户共享此笔记本。当他们将其复制粘贴到本地驱动器中时,其中一些可以运行它并对其进行处理,而另一些可以打印出上述错误。
给出错误的代码如下:
!pip install -U -q PyDrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
# Authenticate and create the PyDrive client.
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
这部分代码显示以下错误:
AuthorizationError Traceback (most recent call last)
<ipython-input-9-6beb6b456bb8> in <module>()
5 from oauth2client.client import GoogleCredentials
6 # Authenticate and create the PyDrive client.
----> 7 auth.authenticate_user()
8 gauth = GoogleAuth()
9 gauth.credentials = GoogleCredentials.get_application_default()
/usr/local/lib/python3.6/dist-packages/google/colab/auth.py in authenticate_user(clear_output)
160 if _check_adc():
161 return
--> 162 raise _errors.AuthorizationError('Failed to fetch user credentials')
AuthorizationError: Failed to fetch user credentials
我一般对colab和gsuite都是陌生的,我不确定如何进行。欢迎任何帮助