We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
Yashik
7 years agoExplorer | Level 4
Dropbox v2 upload cursor offset confusion
I can only upload the first chunk only import dropbox,requests,sys def down(url): dbx=dropbox.Dropbox(AccessToken) size=25*1024*1024 a=0 i=0 params = {'':'', 'render':'dow...
- 7 years ago
[Cross-linking for reference: https://stackoverflow.com/questions/51606801/python3-dropbox-uploading-error-using-api-v2 ]
That error indicates that you're supplying an incorrect offset value for this upload session when uploading a chunk of data. The error includes the correct value, but you'll need to debug your code to see why you're not sending it in the first place. (I don't see where you update the offset value in your code, for example.)
There's a basic example of using upload sessions with the Python SDK here:
- 7 years ago
A 'path/conflict/file' error indicates that the upload failed because there is already a file at the specified path.
You should instead specify a different path, or supply a different WriteMode to to files_upload_session_finish in the CommitInfo to automatically handle the conflict.
Greg-DB
7 years agoDropbox Staff
[Cross-linking for reference: https://stackoverflow.com/questions/51606801/python3-dropbox-uploading-error-using-api-v2 ]
That error indicates that you're supplying an incorrect offset value for this upload session when uploading a chunk of data. The error includes the correct value, but you'll need to debug your code to see why you're not sending it in the first place. (I don't see where you update the offset value in your code, for example.)
There's a basic example of using upload sessions with the Python SDK here:
- Yashik7 years agoExplorer | Level 4I have the variable `a` for offset.
Now i'm getting UploadSessionError('path',WriteError('conflict',WriteConflictError('file',None))))- Greg-DB7 years agoDropbox Staff
A 'path/conflict/file' error indicates that the upload failed because there is already a file at the specified path.
You should instead specify a different path, or supply a different WriteMode to to files_upload_session_finish in the CommitInfo to automatically handle the conflict.
- Yashik7 years agoExplorer | Level 4thanks Now the problem is the offset of files_upload_session_finish , I am using the content length for the offset but it is giving error
Code:
import dropbox,requests,sys
def down(url):
dbx=dropbox.Dropbox(AccessToken)
size=45*1024
a=0
i=0
p=0
params = {'':'', 'render':'download'}
r=requests.get(url,params=params,stream=True)
clen=r.headers['Content-length']
for chunk in r.iter_content(chunk_size=size):
if chunk:
i+=1
a+=len(chunk)
c=a/(1024)
print('\n'+str(c)+' of '+str(clen))
if i==1:
strtid = dbx.files_upload_session_start(chunk)
cursor = dropbox.files.UploadSessionCursor(session_id=strtid.session_id,offset=len(chunk))
commit = dropbox.files.CommitInfo(path='/sourttt',mode=dropbox.files.WriteMode('add'))
if ((int(clen)-p))<=size:
cur=dropbox.files.UploadSessionCursor(session_id=strtid.session_id,offset=int(a))
dbx.files_upload_session_finish(chunk,cur,commit)
else:
dbx.files_upload_session_append(chunk,cursor.session_id,a)
p=a
url='https://speedtest.ftp.otenet.gr/files/test100k.db'
down(url)
Error:
dropbox.exceptions.ApiError: ('281cb346aa41adc8436f415fc4d0de0a', UploadSessionFinishError('lookup_failed', UploadSessionLookupError('incorrect_offset', UploadSessionOffsetError(correct_offset=138240))))
The content length is 100Kb(102400) but the error showing me the correct offset is 138240 and the difference between those are 35Kb . What should I do for offset value in files_upload_session_finish
?
About Discuss Dropbox Developer & API
Make connections with other developers
795 PostsLatest Activity: 6 days 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!