Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hello: I am using this Python code to upload a large zip file (2-4 GB). I am trying to upload the file in chunks, however I am getting a "dropbox.exceptions.ApiError('some_random_numbers', UploadSessionLookupError(u'incorrect_offset', UploadSessionOffsetError(correct_offset=540)))
Here is my code that is uploading the zip file using chunks (from StackOverflow)
f = open(outputName) file_size = os.path.getsize(outputName) CHUNK_SIZE = 10000 if file_size <= CHUNK_SIZE: print dbx.files_upload(f.read(), backupPath) 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=backupPath) 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) #dbx.files_upload_session_append_v2(f.read(CHUNK_SIZE), cursor) cursor.offset = f.tell()
I tried v2 for files_upload_session_append as well. Both doesn't work. Also tried different CHUNK_SIZEs, but doesn't work either. Any suggestions?
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!