【问题标题】:try out PyDrive in windows desktop在 Windows 桌面上试用 PyDrive
【发布时间】:2021-09-07 20:25:03
【问题描述】:

我正在关注this 学习如何使用 PyDrive 库

我在....PycharmProjects\Qt\venv\Lib\site-packages 安装了 PyDrive 我复制代码并保存在c:\users\me\test.py

现在我被困在如何运行它上。我已经有 Google Drive 帐户,其中存储了一些文件。

我需要简单的步骤来从命令提示符或 Idle 或 PyCharm 运行它 我需要谷歌云帐户或其他任何东西吗?

我改成了 (venv)c:\user\me\test.py

我明白了

ERROR  File "..\PycharmProjects\Qt\venv\lib\site-packages\oauth2client\clientsecrets.py", line 121, in _loadfile
    with open(filename, 'r') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'client_secrets.json'
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive

gauth = GoogleAuth()
gauth.LocalWebserverAuth()

drive = GoogleDrive(gauth)

file1 = drive.CreateFile({'title': 'Hello.txt'})
file1.SetContentString('Hello')
file1.Upload() 


docsfile.GetContentFile('test.html', mimetype='text/html')

【问题讨论】:

  • 你是什么意思“改变驱动器”?你在激活Qt/venv??不能直接从 PyCharm 运行脚本吗?

标签: python pydrive


【解决方案1】:

PyDrivePyDrive2 (pip install PyDrive2) 取代

所有 Google SDK 都需要身份验证令牌,您可以 refer to the documentation on how to generate one 以及在哪里创建库读取的 JSON 文件(在您的工作目录中)

还请务必阅读official Google Drive Python API page

【讨论】:

  • 感谢 OneCritekeer 会尝试并回来。
  • 我放弃了这个想法。现在我需要一些帮助来关闭我在谷歌云中的帐户,因为我确信我会忘记并在以后被收费。
猜你喜欢
  • 2020-01-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-05-15
  • 2020-08-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多