Learn how to make the most out of the Dropbox Community here 💙.
Forum Discussion
peytonshc
8 years agoExplorer | Level 3
Unable to download file to a desired path via files_download_to_file using the python api
I am using the files_download_to_file function to try and download a file from my dropbox to a specific location. As parameters I am giving it '/home/user/Desktop' and it is saying IOError: [Errno 21] Is a directory. I am not sure what is wrong with this and would greatly appreciate any support.
7 Replies
Sort By
- Greg-DB
Dropbox Staff
When calling files_download_to_file, the `download_path` parameter should be the full local path where you want to save the file, including the file name and extension. So, instead of '/home/user/Desktop', you should supply something like '/home/user/Desktop/filename.ext'.
- peytonshcExplorer | Level 3
I tried that before but got TypeError: 'FileMetadata' object is not iterable when I try and write it.
- Greg-DB
Dropbox Staff
It looks like there's a mistake in the documentation (we'll get that fixed up), but the files_download_to_file method actually just returns a FileMetadata object (not a tuple), so make sure you're not trying to unpack the result.
I.e., your code should look something like `metadata = dbx.files_download_to_file(...)` not `metadata, result = dbx.files_download_to_file(...)`.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,964 PostsLatest Activity: 14 hours ago
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!