Reputation: 177
I'm trying to overwrite a file on Dropbox with Python 3.4 but can't figure out how to do it. If the file doesn't exist, dbx.files_upload(data, '/file.py')
creates the file as expected.
But if the file exists, I want to overwrite it. I've tried
dbx.files_upload(data, '/file.py', mode=WriteMode('overwrite'))
which gives
NameError: name 'WriteMode' is not defined
and I've tried
dbx.files_upload(data, '/iot_main.py', overwrite=True)
which gives
TypeError: files_upload() got an unexpected keyword argument 'overwrite'
I feel as if I'm missing something obvious but lots of Googling for an answer doesn't help...
Thanks.
Upvotes: 11
Views: 8035
Reputation: 5272
Try this one, from Dropbox SDK Example.
dbx.files_upload(data, '/file.py', mode=dropbox.files.WriteMode.overwrite)
Upvotes: 28