onedrive-sdk-python: ConnectionResetError: [WinError 10054] upon uploading large file
I’m trying to upload a 800mb file, and I get the following error message:
c:\Python36\Scripts>python onedrive.py
https://login.live.com/oauth20_authorize.srf?response_type=code&scope=wl.signin+wl.offline_access+onedrive.readwrite&client_id=0000000044194611&redirect_uri=http%3A%2F%2Flocalhost%2F
127.0.0.1 - - [29/Jul/2016 00:59:10] "GET /?code=<my_code>
HTTP/1.1" 200 -
<class 'str'>
Uploading item/s..
Traceback (most recent call last):
File "c:\python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 578, in urlopen
chunked=chunked)
File "c:\python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 362, in _make_request
conn.request(method, url, **httplib_request_kw)
File "c:\python36\lib\http\client.py", line 1155, in request
self._send_request(method, url, body, headers)
File "c:\python36\lib\http\client.py", line 1200, in _send_request
self.endheaders(body)
File "c:\python36\lib\http\client.py", line 1151, in endheaders
self._send_output(message_body)
File "c:\python36\lib\http\client.py", line 985, in _send_output
self.send(message_body)
File "c:\python36\lib\http\client.py", line 954, in send
self.sock.sendall(datablock)
File "c:\python36\lib\ssl.py", line 887, in sendall
v = self.send(data[count:])
File "c:\python36\lib\ssl.py", line 857, in send
return self._sslobj.write(data)
File "c:\python36\lib\ssl.py", line 582, in write
return self._sslobj.write(data)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\python36\lib\site-packages\requests\adapters.py", line 403, in send
timeout=timeout
File "c:\python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 623, in urlopen
_stacktrace=sys.exc_info()[2])
File "c:\python36\lib\site-packages\requests\packages\urllib3\util\retry.py", line 255, in increment
raise six.reraise(type(error), error, _stacktrace)
File "c:\python36\lib\site-packages\requests\packages\urllib3\packages\six.py", line 309, in reraise
raise value.with_traceback(tb)
File "c:\python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 578, in urlopen
chunked=chunked)
File "c:\python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 362, in _make_request
conn.request(method, url, **httplib_request_kw)
File "c:\python36\lib\http\client.py", line 1155, in request
self._send_request(method, url, body, headers)
File "c:\python36\lib\http\client.py", line 1200, in _send_request
self.endheaders(body)
File "c:\python36\lib\http\client.py", line 1151, in endheaders
self._send_output(message_body)
File "c:\python36\lib\http\client.py", line 985, in _send_output
self.send(message_body)
File "c:\python36\lib\http\client.py", line 954, in send
self.sock.sendall(datablock)
File "c:\python36\lib\ssl.py", line 887, in sendall
v = self.send(data[count:])
File "c:\python36\lib\ssl.py", line 857, in send
return self._sslobj.write(data)
File "c:\python36\lib\ssl.py", line 582, in write
return self._sslobj.write(data)
requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "onedrive.py", line 23, in <module>
client.item(drive="me", id="8930240577EB1134%2166557").children["Agron_reshumon.rar"].upload("//dd-wrt/usb/Upload/Agron_reshumon.rar")
File "c:\python36\lib\site-packages\onedrivesdk\request\item_request_builder.py", line 134, in upload
return self.content.request().upload(local_path)
File "c:\python36\lib\site-packages\onedrivesdk\request\item_content_request.py", line 59, in upload
entity_response = self.send(path=content_local_path)
File "c:\python36\lib\site-packages\onedrivesdk\request_base.py", line 145, in send
path=path)
File "c:\python36\lib\site-packages\onedrivesdk\http_provider.py", line 61, in send
response = session.send(prepped)
File "c:\python36\lib\site-packages\requests\sessions.py", line 585, in send
r = adapter.send(request, **kwargs)
File "c:\python36\lib\site-packages\requests\adapters.py", line 453, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
I guess this error is probably due to a limit of the uploaded file size (100mb)? If so, it would be nice if the SDK checks the file size prior to uploading, and breaks it to chunks, or notifies, or this feature is already implemented?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (8 by maintainers)
I didn’t understand much from dev.onedrive.com documentation, but you’ve identified the problem properly!
So, this variations work: client.item(drive=“me”, path=“/RoyalTSInstaller.msi”).upload_async(“./RoyalTSInstaller.msi”) client.item(drive=“me”, path=“Uploaded/test1.mp3”).upload_async(“./test1.mp3”)
Thanks!