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%.
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?
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)
my_file = open(filename, 'wb')
my_file.write(fh)
my_file.close()
EDIT: information for others - as @michelle.70 found - we can use
fh = io.FileIO(filename, 'wb')
instead of fh = io.BytesIO()
and it will save it in file.
It should also work if you use normal open()
fh = open(filename, 'wb')
Don't forget to close fh
(in both methods).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With