googlearchive / PyDrive

Google Drive API Python wrapper library
Other
1.31k stars 273 forks source link

GetContentString() returns UnicodeDecodeError: 'utf-8' codec can't decode byte #195

Closed thekillgfx closed 4 years ago

thekillgfx commented 4 years ago
drive = GoogleDrive(await gAuth())
return drive.CreateFile({'id': id}).GetContentString()

The error displayed is the following: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc5 in position 42: invalid continuation byte. I don't know how to provide you the string that the function fail to process, if needed I'll try to get it anyway. The file is a .MOV video.

I've also tried with the option that @RNabel suggest here https://github.com/gsuitedevs/PyDrive/issues/74, so

f = drive.CreateFile({'id': id})
f.FetchContent()
content_string = f.content.getvalue().decode('unicode_escape')

the error returned this time is UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 34583-34584: truncated \uXXXX escape