我正在尝试使用 python 的 pydrive 模块自动从谷歌驱动器下载一个简单的文本文件。我不断收到以下错误:
回溯(最后一次调用):文件“C:\GIS\AVGOPS\Scripts\GoogleDrive_Test.py”,第 20 行,在 item.GetContentFile(r'C:\Users\pfilyer\Desktop\googedrive\' + item['标题']) 文件“C:\Python27\ArcGIS10.4\lib\site-packages\pydrive\files.py”,第 210 行,在 GetContentFile self.FetchContent(mimetype, remove_bom) 文件“C:\Python27\ArcGIS10. 4\lib\site-packages\pydrive\files.py”,第 43 行,在 _decorated 返回 decoratee(self, *args, **kwargs) 文件“C:\Python27\ArcGIS10.4\lib\site-packages\pydrive \files.py",第 265 行,在 FetchContent 'No downloadLink/exportLinks for mimetype found in metadata') FileNotDownloadableError: No downloadLink/exportLinks for mimetype found in metadata
有什么建议么?
import pydrive
from pydrive.drive import GoogleDrive
from pydrive.auth import GoogleAuth
gauth = GoogleAuth()
gauth.LoadCredentialsFile(r"C:\Users\XXXXX\.credentials\drive-python-quickstart.json")
drive = GoogleDrive(gauth)
print "Auth Success"
folder_id = '0BxbuUXtrs7adSFFYMG0zS3VZNFE'
lister = drive.ListFile({'q': "'%s' in parents" % folder_id}).GetList()
for item in lister:
print item['title']
item.GetContentFile(r'C:\Users\XXXXX\Desktop\googedrive\\' + item['title'])