Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
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:
Thank you for your help!
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.
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)
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.
@ms97 Здравко is correct; your output shows that your file upload was empty, which is why the Dropbox web site was not able to show the contents. You'll need to debug your integration to make sure you correctly upload the non-empty data.
I am getting a similar response when just switching the folder I am uploading to:
FileMetadata(client_modified=datetime.datetime(2023, 8, 10, 16, 22, 13), content_hash='e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', export_info=NOT_SET, file_lock_info=NOT_SET, has_explicit_shared_members=NOT_SET, id='id:MfcxP9MMQyMAAAAAAAAAHg', is_downloadable=True, media_info=NOT_SET, name='test.zip', parent_shared_folder_id=NOT_SET, path_display='/Folder2/test.zip', path_lower='/folder2/test.zip', preview_url=NOT_SET, property_groups=NOT_SET, rev='0160293ffb9dc8f0000000104e641f1', server_modified=datetime.datetime(2023, 8, 10, 16, 22, 14), sharing_info=NOT_SET, size=0, symlink_info=NOT_SET)
So my problem has nothing to do with the file itself because it has been uploaded into another folder successfully:
FileMetadata(client_modified=datetime.datetime(2023, 8, 10, 16, 28, 4), content_hash='e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', export_info=NOT_SET, file_lock_info=NOT_SET, has_explicit_shared_members=NOT_SET, id='id:qzdXOVVbA8AAAAAAAAUJ_w', is_downloadable=True, media_info=NOT_SET, name='test.zip', parent_shared_folder_id='4391826353', path_display='/Folder1/test.zip', path_lower='/folder1/test.zip', preview_url=NOT_SET, property_groups=NOT_SET, rev='016029414a2b7250000000105c5f3b1', server_modified=datetime.datetime(2023, 8, 10, 16, 28, 4), sharing_info=FileSharingInfo(modified_by='dbid:AAB_CoHtiOlASmyE9l1g_5pdrDuPG1s2CIQ', parent_shared_folder_id='4391826353', read_only=False), size=0, symlink_info=NOT_SET)
What do you think it could be?
@credentially-dev-team Both samples you shared here show 'size=0', meaning that both files were uploaded with empty contents. Please check your upload code to make sure you're uploading the non-empty contents that you expect for the files.
@credentially-dev-team wrote:...
FileMetadata(..., size=0, ...)So my problem has nothing to do with the file itself because it has been uploaded into another folder successfully:
FileMetadata(..., size=0, ...)What do you think it could be?
I think you cannot read those empty archives content in both cases. 🙋
@Здравко
Yes, but still. Via UI I can see the file in Folder1 so it turns out empty files can be uploaded 🙂
@credentially-dev-team Dropbox allows you to upload empty files (that is, files with size of 0), but empty files are not valid zip files.
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 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!