<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Dropbox v2 upload cursor offset confusion in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288017#M109</link>
    <description>I can only upload the first chunk only &lt;BR /&gt;&lt;BR /&gt;	import dropbox,requests,sys&lt;BR /&gt;	def down(url):&lt;BR /&gt;		dbx=dropbox.Dropbox(AccessToken)&lt;BR /&gt;	&lt;BR /&gt;		size=25*1024*1024&lt;BR /&gt;		a=0&lt;BR /&gt;		i=0&lt;BR /&gt;		&lt;BR /&gt;		params = {'':'', 'render':'download'}&lt;BR /&gt;	&lt;BR /&gt;		r=requests.get(url,params=params,stream=True)&lt;BR /&gt;		clen=r.headers['Content-length']&lt;BR /&gt;	&lt;BR /&gt;		for chunk in r.iter_content(chunk_size=size):&lt;BR /&gt;	&lt;BR /&gt;			if chunk:&lt;BR /&gt;				i+=1&lt;BR /&gt;				a+=len(chunk)&lt;BR /&gt;				&lt;BR /&gt;				c=a/(1024*1024)&lt;BR /&gt;				sys.stdout.write('\r'+str(round(c,2)))&lt;BR /&gt;				if i==1:&lt;BR /&gt;					strtid = dbx.files_upload_session_start(chunk)&lt;BR /&gt;					cursor = dropbox.files.UploadSessionCursor(session_id=strtid.session_id,offset=a)&lt;BR /&gt;					commit = dropbox.files.CommitInfo(path='/source')&lt;BR /&gt;				if (clen-a)&amp;lt;size:&lt;BR /&gt;					dbx.files_upload_session_finish(chunk,cursor,commit)&lt;BR /&gt;					&lt;BR /&gt;				else:&lt;BR /&gt;					dbx.files_upload_session_append(chunk,cursor.session_id,cursor.offset)&lt;BR /&gt;				&lt;BR /&gt;		&lt;BR /&gt;	url='&lt;A href="https://downloads.sourceforge.net/project/openofficeorg.mirror/extended/iso/en/OOo_3.3.0_Win_x86_install_en-US_20110219.iso?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fopenofficeorg.mirror%2F%3Fsource%3Ddirectory&amp;amp;ts=1533004315&amp;amp;use_mirror=excellmedia" target="_blank"&gt;https://downloads.sourceforge.net/project/openofficeorg.mirror/extended/iso/en/OOo_3.3.0_Win_x86_install_en-US_20110219.iso?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fopenofficeorg.mirror%2F%3Fsource%3Ddirectory&amp;amp;ts=1533004315&amp;amp;use_mirror=excellmedia&lt;/A&gt;'&lt;BR /&gt;	down(url)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And  I got a error&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Traceback (most recent call last):&lt;BR /&gt;&amp;gt;  File "/home/google2drive/mysite/templates/u.py", line 38, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;gt;    down(url)&lt;BR /&gt;&amp;gt;  File "/home/google2drive/mysite/templates/u.py", line 32, in down&lt;BR /&gt;&amp;gt;    dbx.files_upload_session_append(chunk,cursor.session_id,cursor.offset)&lt;BR /&gt;&amp;gt;  File "/home/google2drive/.local/lib/python3.6/site-packages/dropbox/base.py", line 2242, in files_upload_session_append&lt;BR /&gt;&amp;gt;    f,&lt;BR /&gt;&amp;gt;  File "/home/google2drive/.local/lib/python3.6/site-packages/dropbox/dropbox.py", line 296, in request&lt;BR /&gt;&amp;gt;    user_message_locale)&lt;BR /&gt;&amp;gt;dropbox.exceptions.ApiError: &amp;gt;ApiError('0e6a9a0abf5e491efe40d71e4c6cdb76', &amp;gt;UploadSessionLookupError('incorrect_offset', &amp;gt;UploadSessionOffsetError(correct_offset=52428800)))</description>
    <pubDate>Wed, 29 May 2019 09:05:54 GMT</pubDate>
    <dc:creator>Yashik</dc:creator>
    <dc:date>2019-05-29T09:05:54Z</dc:date>
    <item>
      <title>Dropbox v2 upload cursor offset confusion</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288017#M109</link>
      <description>I can only upload the first chunk only &lt;BR /&gt;&lt;BR /&gt;	import dropbox,requests,sys&lt;BR /&gt;	def down(url):&lt;BR /&gt;		dbx=dropbox.Dropbox(AccessToken)&lt;BR /&gt;	&lt;BR /&gt;		size=25*1024*1024&lt;BR /&gt;		a=0&lt;BR /&gt;		i=0&lt;BR /&gt;		&lt;BR /&gt;		params = {'':'', 'render':'download'}&lt;BR /&gt;	&lt;BR /&gt;		r=requests.get(url,params=params,stream=True)&lt;BR /&gt;		clen=r.headers['Content-length']&lt;BR /&gt;	&lt;BR /&gt;		for chunk in r.iter_content(chunk_size=size):&lt;BR /&gt;	&lt;BR /&gt;			if chunk:&lt;BR /&gt;				i+=1&lt;BR /&gt;				a+=len(chunk)&lt;BR /&gt;				&lt;BR /&gt;				c=a/(1024*1024)&lt;BR /&gt;				sys.stdout.write('\r'+str(round(c,2)))&lt;BR /&gt;				if i==1:&lt;BR /&gt;					strtid = dbx.files_upload_session_start(chunk)&lt;BR /&gt;					cursor = dropbox.files.UploadSessionCursor(session_id=strtid.session_id,offset=a)&lt;BR /&gt;					commit = dropbox.files.CommitInfo(path='/source')&lt;BR /&gt;				if (clen-a)&amp;lt;size:&lt;BR /&gt;					dbx.files_upload_session_finish(chunk,cursor,commit)&lt;BR /&gt;					&lt;BR /&gt;				else:&lt;BR /&gt;					dbx.files_upload_session_append(chunk,cursor.session_id,cursor.offset)&lt;BR /&gt;				&lt;BR /&gt;		&lt;BR /&gt;	url='&lt;A href="https://downloads.sourceforge.net/project/openofficeorg.mirror/extended/iso/en/OOo_3.3.0_Win_x86_install_en-US_20110219.iso?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fopenofficeorg.mirror%2F%3Fsource%3Ddirectory&amp;amp;ts=1533004315&amp;amp;use_mirror=excellmedia" target="_blank"&gt;https://downloads.sourceforge.net/project/openofficeorg.mirror/extended/iso/en/OOo_3.3.0_Win_x86_install_en-US_20110219.iso?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fopenofficeorg.mirror%2F%3Fsource%3Ddirectory&amp;amp;ts=1533004315&amp;amp;use_mirror=excellmedia&lt;/A&gt;'&lt;BR /&gt;	down(url)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And  I got a error&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Traceback (most recent call last):&lt;BR /&gt;&amp;gt;  File "/home/google2drive/mysite/templates/u.py", line 38, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;gt;    down(url)&lt;BR /&gt;&amp;gt;  File "/home/google2drive/mysite/templates/u.py", line 32, in down&lt;BR /&gt;&amp;gt;    dbx.files_upload_session_append(chunk,cursor.session_id,cursor.offset)&lt;BR /&gt;&amp;gt;  File "/home/google2drive/.local/lib/python3.6/site-packages/dropbox/base.py", line 2242, in files_upload_session_append&lt;BR /&gt;&amp;gt;    f,&lt;BR /&gt;&amp;gt;  File "/home/google2drive/.local/lib/python3.6/site-packages/dropbox/dropbox.py", line 296, in request&lt;BR /&gt;&amp;gt;    user_message_locale)&lt;BR /&gt;&amp;gt;dropbox.exceptions.ApiError: &amp;gt;ApiError('0e6a9a0abf5e491efe40d71e4c6cdb76', &amp;gt;UploadSessionLookupError('incorrect_offset', &amp;gt;UploadSessionOffsetError(correct_offset=52428800)))</description>
      <pubDate>Wed, 29 May 2019 09:05:54 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288017#M109</guid>
      <dc:creator>Yashik</dc:creator>
      <dc:date>2019-05-29T09:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox v2 upload cursor offset confusion</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288102#M110</link>
      <description>&lt;P&gt;[Cross-linking for reference:&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/51606801/python3-dropbox-uploading-error-using-api-v2" target="_blank"&gt;https://stackoverflow.com/questions/51606801/python3-dropbox-uploading-error-using-api-v2&lt;/A&gt; ]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's a basic example of using upload sessions with the Python SDK here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/a/43724479/1305693" target="_blank"&gt;https://stackoverflow.com/a/43724479/1305693&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 14:38:26 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288102#M110</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-07-31T14:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox v2 upload cursor offset confusion</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288154#M111</link>
      <description>I have the variable `a` for offset.&lt;BR /&gt;Now i'm getting UploadSessionError('path',WriteError('conflict',WriteConflictError('file',None))))</description>
      <pubDate>Tue, 31 Jul 2018 16:56:34 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288154#M111</guid>
      <dc:creator>Yashik</dc:creator>
      <dc:date>2018-07-31T16:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox v2 upload cursor offset confusion</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288169#M113</link>
      <description>&lt;P&gt;A 'path/conflict/file' &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.files.WriteConflictError" target="_self"&gt;error&lt;/A&gt; indicates that the upload failed because there is already a file at the specified path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should instead specify a different path, or&amp;nbsp;supply&amp;nbsp;a different&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.files.WriteMode" target="_blank"&gt;WriteMode&lt;/A&gt; to to&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.dropbox.Dropbox.files_upload_session_finish" target="_blank"&gt;files_upload_session_finish&lt;/A&gt; in the &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.files.CommitInfo" target="_blank"&gt;CommitInfo&lt;/A&gt;&amp;nbsp;to automatically handle the conflict.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 17:42:30 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288169#M113</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-07-31T17:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox v2 upload cursor offset confusion</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288736#M121</link>
      <description>thanks 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&lt;BR /&gt;&lt;BR /&gt;Code:&lt;BR /&gt;&lt;BR /&gt;    import dropbox,requests,sys&lt;BR /&gt;    def down(url):&lt;BR /&gt;&lt;BR /&gt;dbx=dropbox.Dropbox(AccessToken)&lt;BR /&gt;&lt;BR /&gt;size=45*1024&lt;BR /&gt;a=0&lt;BR /&gt;i=0&lt;BR /&gt;p=0&lt;BR /&gt;params = {'':'', 'render':'download'}&lt;BR /&gt;r=requests.get(url,params=params,stream=True)&lt;BR /&gt;clen=r.headers['Content-length']&lt;BR /&gt;&lt;BR /&gt;for chunk in r.iter_content(chunk_size=size):&lt;BR /&gt;&lt;BR /&gt;if chunk:&lt;BR /&gt;i+=1&lt;BR /&gt;a+=len(chunk)&lt;BR /&gt;c=a/(1024)&lt;BR /&gt;print('\n'+str(c)+' of '+str(clen))&lt;BR /&gt;if i==1:&lt;BR /&gt;strtid = dbx.files_upload_session_start(chunk)&lt;BR /&gt;cursor = dropbox.files.UploadSessionCursor(session_id=strtid.session_id,offset=len(chunk))&lt;BR /&gt;commit = dropbox.files.CommitInfo(path='/sourttt',mode=dropbox.files.WriteMode('add'))&lt;BR /&gt;if ((int(clen)-p))&amp;lt;=size:&lt;BR /&gt;cur=dropbox.files.UploadSessionCursor(session_id=strtid.session_id,offset=int(a))&lt;BR /&gt;dbx.files_upload_session_finish(chunk,cur,commit)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;else:&lt;BR /&gt;dbx.files_upload_session_append(chunk,cursor.session_id,a)&lt;BR /&gt;p=a&lt;BR /&gt;&lt;BR /&gt;url='&lt;A href="https://speedtest.ftp.otenet.gr/files/test100k.db" target="_blank"&gt;https://speedtest.ftp.otenet.gr/files/test100k.db&lt;/A&gt;'&lt;BR /&gt;down(url)&lt;BR /&gt;&lt;BR /&gt;Error:&lt;BR /&gt;&lt;BR /&gt;dropbox.exceptions.ApiError: ('281cb346aa41adc8436f415fc4d0de0a', UploadSessionFinishError('lookup_failed', UploadSessionLookupError('incorrect_offset', UploadSessionOffsetError(correct_offset=138240))))&lt;BR /&gt;&lt;BR /&gt;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&lt;BR /&gt;?</description>
      <pubDate>Fri, 03 Aug 2018 10:29:18 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288736#M121</guid>
      <dc:creator>Yashik</dc:creator>
      <dc:date>2018-08-03T10:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox v2 upload cursor offset confusion</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288805#M126</link>
      <description>The offset value works the same way for files_upload_session_finish as it does for the other calls. It should match how much data you've uploaded in the upload session so far. &lt;BR /&gt;&lt;BR /&gt;It sounds like you may have a bug where you're uploading more data than expected. I recommend adding extra logging or working through your code in a debugger to determine where the discrepancy is taking place.</description>
      <pubDate>Fri, 03 Aug 2018 15:43:45 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288805#M126</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-08-03T15:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox v2 upload cursor offset confusion</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288813#M127</link>
      <description>At the first initialisation for cursor the offset value is 45kb. And I am trying to upload 100kb file .so after 2 iterations uploaded data is 90kb and on finishing I have set the cursor.offset to total size of the file that is 100kb ,but it is returning error saying the correct offset is 135kb .45+45+45=135kb , on third iteration which is last it is showing that it needs the correct offset is 135kb but the original file length is only 100kb. So what am I missing?</description>
      <pubDate>Fri, 03 Aug 2018 16:31:12 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288813#M127</guid>
      <dc:creator>Yashik</dc:creator>
      <dc:date>2018-08-03T16:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox v2 upload cursor offset confusion</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288817#M128</link>
      <description>Updated my code still the same,How can I preformat my code so the code could be more understanding like in stackoverflow we could use 4 blank space .?&lt;BR /&gt;&lt;BR /&gt;import dropbox,requests&lt;BR /&gt;&lt;BR /&gt;d=dropbox.Dropbox(AccesToken)&lt;BR /&gt;t=0&lt;BR /&gt;f=True&lt;BR /&gt;clos=False&lt;BR /&gt;r=requests.get('&lt;A href="https://www.sample-videos.com/text/Sample-text-file-10kb.txt',stream=True" target="_blank"&gt;https://www.sample-videos.com/text/Sample-text-file-10kb.txt',stream=True&lt;/A&gt;)&lt;BR /&gt;c=r.headers['Content-length']&lt;BR /&gt;for a in r.iter_content(chunk_size=4*1024):&lt;BR /&gt;if f:&lt;BR /&gt;t+=len(a)&lt;BR /&gt;start=d.files_upload_session_start(a)&lt;BR /&gt;cursor=dropbox.files.UploadSessionCursor(session_id=start.session_id,offset=len(a))&lt;BR /&gt;&lt;BR /&gt;commit=dropbox.files.CommitInfo('/as',mode=dropbox.files.WriteMode('add'))&lt;BR /&gt;f=False&lt;BR /&gt;else :&lt;BR /&gt;if (int(c)-t)&amp;amp;lt;=(4*1024):&lt;BR /&gt;&lt;BR /&gt;clos=True&lt;BR /&gt;&lt;BR /&gt;d.files_upload_session_append_v2(a,cursor,close=clos)</description>
      <pubDate>Fri, 03 Aug 2018 17:19:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288817#M128</guid>
      <dc:creator>Yashik</dc:creator>
      <dc:date>2018-08-03T17:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox v2 upload cursor offset confusion</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288840#M129</link>
      <description>Can you add extra logging or work through your code in a debugger to determine where the discrepancy is taking place?&lt;BR /&gt;&lt;BR /&gt;By the way, if you use the "Reply" option (not "Quick Reply), the forum's "Rich Text" editor has a code button you can use to get code formatting. The button has a label like "&amp;lt;/&amp;gt;".</description>
      <pubDate>Fri, 03 Aug 2018 18:59:36 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/288840#M129</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-08-03T18:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox v2 upload cursor offset confusion</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/613999#M2829</link>
      <description>&lt;P&gt;&lt;SPAN&gt;In python with sessions upload add the parm&amp;nbsp;mode=dropbox.files.WriteMode('overwrite')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;To overwrite the file with the name already exists&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 15:22:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-v2-upload-cursor-offset-confusion/m-p/613999#M2829</guid>
      <dc:creator>robertgaleano</dc:creator>
      <dc:date>2022-08-04T15:22:32Z</dc:date>
    </item>
  </channel>
</rss>

