We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
ms97
2 years agoExplorer | Level 3
Error (415) from Python files_upload API
Hello,
I am trying to write a python script to automatically store an excel file in dropbox. My excel file is created from turning dataframes into excel sheets. This file has 5 sheets with a different dataframe on each sheet. The file size is less than 150 MB.
The file shows up in my specified folder, but shows an Error (415) and cannot be opened or download. The API gave no errors in my terminal when it ran.
Here is my code:
dbx.files_upload(output.read(), '/testfile3xlsx', mode=dropbox.files.WriteMode.overwrite)
where output is an excel sheet created using pd.ExcelWriter()
Thank you for your help!
- Greg-DBDropbox Staff
Can you show where/how you're getting the 415 error? For instance, is that happening on the Dropbox web site? It may be helpful if you can share a screenshot of it. If it's on the web site, be sure to show the URL for context.
Also, if the files_upload method doesn't raise an error, it should return a value containing the metadata of the uploaded file, so it may be helpful context if you can print out and share that too.
- ms97Explorer | Level 3
I am seeing the 415 error when I try to open the file in the dropbox UI.
Here is the metadata that was returned:
FileMetadata(client_modified=datetime.datetime(2023, 4, 17, 16, 26, 35), content_hash='e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', export_info=NOT_SET, file_lock_info=NOT_SET, has_explicit_shared_members=NOT_SET, id='id:FgdW-Cdpb8oAAAAAAAAAGA', is_downloadable=True, media_info=NOT_SET, name='testfile3.xlsx', parent_shared_folder_id=NOT_SET, path_display='/testfile3.xlsx', path_lower='/testfile3.xlsx', preview_url=NOT_SET, property_groups=NOT_SET, rev='5f98aa794ffabe9475031', server_modified=datetime.datetime(2023, 4, 17, 16, 26, 35), sharing_info=NOT_SET, size=0, symlink_info=NOT_SET)
- ЗдравкоLegendary | Level 20
Hi ms97,
The metadata, you posted, shows that you have uploaded nothing. That's why an error appears. Hm.. 🤔 Such error can show a more useful message, but... Let's hope this will be improved and no so strange and confusing message gonna appear. 😁
Anyway, check what you're passing using 'output.read()' during your upload. As seems it's empty. 😉
Hope this gives direction.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 3 hours agoIf 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!