我正在尝试使用 PyDrive 获取我的 Google Drive 中所有文件的列表。我已阅读文档并完成了所有步骤。我保存了客户端 secrets.json,但我继续收到以下错误。我正在使用的代码是:
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
# Creates local webserver and auto handles authentication
drive = GoogleDrive(gauth)
file_list = drive.ListFile({'q': "'root' in parents and trashed=false"}).GetList()
for file1 in file_list:
print 'title: %s, id: %s' % (file1['title'], file1['id'])
我得到的错误是,我该如何解决这个问题?
Traceback (most recent call last):
File "C:\Users\mydrive\Documents\Python\Google_Drive.py", line 5, in <module>
gauth.LocalWebserverAuth()
File "build\bdist.win-amd64\egg\pydrive\auth.py", line 67, in _decorated
self.GetFlow()
File "build\bdist.win-amd64\egg\pydrive\auth.py", line 345, in GetFlow
self.LoadClientConfig()
File "build\bdist.win-amd64\egg\pydrive\auth.py", line 294, in LoadClientConfig
self.LoadClientConfigFile()
File "build\bdist.win-amd64\egg\pydrive\auth.py", line 314, in LoadClientConfigFile
raise InvalidConfigError('Invalid client secrets file %s' % error)
InvalidConfigError: Invalid client secrets file File not found: "client_secrets.json"