I'm struggling to upload files to Dropbox via Python using their module. The error is always the following:
UnicodeEncodeError: 'latin-1' codec can't encode character '\u200b' in position 71: ordinal not in range(256)
Originally, I thought it was an encoding error with the CSV I was trying to upload, so I tried replacing any '\u200b' (zero-width space) with a normal space in my CSV, but I still got the same error. I changed the encoding settings when I went to write the CSV-- same error. I even tried going into the code file that was generating the error and changing it's encoding to 'utf-8' and I just got an error from having changed it (I set it back to normal).
So I'm really flummoxed on this error. Maybe you guys can enlighten me. I've been able to generate this error in a really simple context in a way that's practically identical to what I'm using.
Here's the CSV that I'm trying to upload (file.csv):
a,b,c
d,e,f
And here is my code that throws the error:
import dropbox
dbx = dropbox.dropbox.Dropbox('my_token')
with open('file.csv', 'rb') as f:
dbx.files_upload(f.read(), '/path/to/file.csv', mode=dropbox.files.WriteMode.overwrite)
I've been trying to follow the documentation to a T and as far as I can tell, I am...? Here is a link to the documentation if that's helpful.
Anything you guys can do to even push me in the right direction would be appreciated.