问题描述
我使用此处找到的 python 代码下载了谷歌驱动器上的文件:https://developers.google.com/drive/v3/web/manage-downloads我有这个范围:https://www.googleapis.com/auth/drive一切似乎都有效,我读到:
I used the python code found here to download a file on google drive: https://developers.google.com/drive/v3/web/manage-downloads I have this scope: https://www.googleapis.com/auth/drive everything seems to work, I read:
Download 35%.
Download 71%.
Download 100%.
但是文件在哪里?在与python文件相同的目录中,没有任何东西,既不是根目录,也不是主目录……你有想法吗?或者我该如何调试?
but where is the file? in the same directory as the python file, there is nothing, neither the root, nor in the home ... you have ideas? or alternatively how can I debug?
推荐答案
Google doc 使用示例
Example in Google doc uses
fh = io.BytesIO()
所以它将数据读入内存,而不是保存在磁盘上.
so it reads data into memory and it doesn't save on disk.
您必须使用(例如)保存它
You have to save it using (for example)
open(..., 'wb')
write(fh)
close()
<小时>
编辑:其他人的信息 - 正如@michelle.70 发现的那样 - 我们可以使用
EDIT: information for others - as @michelle.70 found - we can use
fh = io.FileIO(filename, 'wb')
而不是 fh = io.BytesIO()
这篇关于Python google drive API 下载,文件在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)