python - 从 google colab 访问 google 驱动程序 - 失败(“意外错误响应 :

标签 python drive google-colaboratory

我按照以下说明通过 google colab 访问 google 云端硬盘:gdrive_colab

前两个单元格工作正常,但以下单元格:

# Generate creds for the Drive FUSE library.
from oauth2client.client import GoogleCredentials
creds = GoogleCredentials.get_application_default()
import getpass
# Work around misordering of STREAM and STDIN in Jupyter.
# https://github.com/jupyter/notebook/issues/3159
prompt = !google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
vcode = getpass.getpass(prompt[0] + '\n\nEnter verification code: ')
!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}

生成以下错误:

Please, open the following URL in a web browser: https://accounts.google.com/o/oauth2/auth?client_id=32555940559.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&response_type=code&access_type=offline&approval_prompt=force
Please enter the verification code: Cannot retrieve auth tokens.
Failure("Unexpected error response: {\n  \"error\" : \"invalid_grant\",\n  \"error_description\" : \"Malformed auth code.\"\n}")
Please, open the following URL in a web browser: https://accounts.google.com/o/oauth2/auth?client_id=32555940559.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&response_type=code&access_type=offline&approval_prompt=force

Enter verification code: ··········

有什么想法可以解决这个问题吗?

最佳答案

这只是新版本的一个错误。这是solution

关于python - 从 google colab 访问 google 驱动程序 - 失败(“意外错误响应 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51935694/

相关文章:

python - 在什么情况下你应该在 python 中实际使用生成器?

python - 列表列表更改意外地反射(reflect)在子列表中

python - 根据其他数据帧的日期时间列过滤数据帧

javascript - 云端硬盘选择器上传到团队云端硬盘而不是个人 Google 云端硬盘

python - 在 Google Colab Pro 中使用 TPU v3

github - 谷歌colab : Missing the whole organization in the "Open Notebook" --> Github

python - 将 django 模型移动到另一个应用程序,该应用程序是另一个模型的父模型

windows-services - 如何在 Windows 服务中为 Clearcase View 映射网络驱动器?

Google 云端硬盘中的 CSS 样式表不再有效

google-colaboratory - 如何在colab tensorflow中使用上传的文件?