Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hi, I have been trying for a few days to upload a big file into my Dropbox account using the python API,
i have tried using the following code:
f = open(file_path) file_size = os.path.getsize(file_path) CHUNK_SIZE = 4 * 1024 * 1024 if file_size <= CHUNK_SIZE: print dbx.files_upload(f.read(), dest_path) else: upload_session_start_result = dbx.files_upload_session_start(f.read(CHUNK_SIZE)) cursor = dropbox.files.UploadSessionCursor(session_id=upload_session_start_result.session_id, offset=f.tell()) commit = dropbox.files.CommitInfo(path=dest_path) while f.tell() < file_size: if ((file_size - f.tell()) <= CHUNK_SIZE): print dbx.files_upload_session_finish(f.read(CHUNK_SIZE), cursor, commit) else: dbx.files_upload_session_append(f.read(CHUNK_SIZE), cursor.session_id, cursor.offset) cursor.offset = f.tell() f.close()
but everytime i get the same exception when reaching
dbx.files_upload_session_finish(f.read(CHUNK_SIZE), cursor, commit)
the exception is:
dropbox.exceptions.ApiError: ApiError('fa8b9a1a5c61684f4e6f58f2c695c248', UploadSessionFinishError('path', WriteError('malformed_path', None)))
I have been stuck on this for days, anyone has any suggestions?
(I have tried already switching the following function to the v2 version, but it didn't helpped
files_upload_session_append
just '/'(home folder), when i try to upload a smaller file to the same destination it works.
just '/'(home folder), when i try to upload a smaller file to the same destination it works.
The root should be "", not "/".
whenever i try to use "" as the root dir I get:
dropbox.stone_validators.ValidationError: '' did not match pattern '(/(.|[\r\n])*)|(ns:[0-9]+(/.*)?)'
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!