Python Google Drive API下载,文件在哪里?
我使用此处找到的python代码在Google驱动器上下载文件: 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文档中的示例使用
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()