問題描述
我使用此處找到的 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模板網!