I am making a Python script to upload mp3 files in my Music folder to Dropbox, but I cannot figure out how to do so. I am using Dropbox API and here's my code
import dropbox
dbx = dropbox.Dropbox('*******')
dbx.users_get_current_account()
f = open('Channa Mereya.mp3', 'rb')
dbx.files_upload(bytes(f.read()), 'Channa Mereya.mp3')
but I get the error
dropbox.stone_validators.ValidationError: 'Channa Mereya.mp3' did not match pattern '(/(.|[\r\n])*)|(ns:[0-9]+(/.*)?)'
I don't know much about regex patterns.
Also while reading API documentation, files_upload
takes first argument as bytes, I don't why it takes bytes.
I also tried to just pass the path of mp3 file instead of opening and passing the file like
dbx.files_upload("/home/username/python projects/Channa Mereya.mp3", 'Channa Mereya.mp3')
Here Channa Mereya.mp3
is a mp3 file stored in the same directory as the
script