Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
#Solved!
#Python SDK (python package) for Dropbox
#Problem
dbx.files_download_to_file(download_path="/downloads", path="/fileToDownload.txt")
#returns [Errno 13] Permission Denied
#Solution
#Omit "/" before directory path name
#download_path="downloads"
dbx.files_download_to_file(download_path="downloads", path="/fileToDownload.txt")
#end Solution section
#Download - Convert String to Bytes (search label references: convert text to bytes; str() to b''; string to b''; str() to b""; string to b"")
#Also; download returns bytes variable to save to file; however, you can decode it, to save the text as a string (python str() variable type), as follows:
metadata, variable_result = dbx.files_download(path='/fileToDownload.txt')
#bytes are returned as variable_result.content
#change them to a string, as follows:
variable_bytes = variable_result.content
variable_string = variable_bytes.decode("utf-8")
f = open("saveTextHere.txt", "x")
f.write(variable_string)
f.close()
#Upload - Convert Bytes to String (search label references: convert text to bytes; str() to bytes; str() to b''; str() to b""; string to b''; string to b"")
t = str("My text to save to upload file. Upload this text to user's Dropbox.com.")
b = t.encode('ascii')
f = '/newFileAtDropbox.txt'
dbx.files_upload(b, f)
#view your uploaded file; file location - Dropbox.com, folder: Dropbox/Apps/[appFolderName]
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on Twitter or Facebook.
For more info on available support options, see this article.
If you found the answer to your question, please 'like' the post to say thanks to the user!