Hi Dropbox Team,
i'm using a script to send larger files (more 1 GB) but i have an error :
Script i use :
import dropbox, sys, os
dbx = dropbox.Dropbox('MY KEY')
file_path = 'My local file_path'
f = open(file_path, "rb")
file_size = os.path.getsize(file_path)
dest_path = 'My Dropbox dest_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()
The error :
Traceback (most recent call last):
File "upload-bakcup-dropbox.py", line 31, in <module>
print(dbx.files_upload(f.read(), dest_path))
File "C:\Users\Administrateur\AppData\Local\Programs\Python\Python36\lib\site-packages\dropbox-0.0.0-py3.6.egg\dropbox\base.py", line 2076, in files_upload
f,
File "C:\Users\Administrateur\AppData\Local\Programs\Python\Python36\lib\site-packages\dropbox-0.0.0-py3.6.egg\dropbox\dropbox.py", line 256, in request
user_message_locale)
dropbox.exceptions.ApiError: ApiError('ecbd1ad61a0596454c7943e4243d10a7', UploadError('path', UploadWriteFailed(reason=WriteError('conflict', WriteConflictError('folder', None)), u
pload_session_id='AAAAAAAAAeBQJPdCxI5KAQ')))
Could you help me ?
Thanks