cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted

socket.timeout: The write operation timed out

Explorer | Level 3

Hi,

 

I am trying to uload a single file based on the example code from here: https://github.com/dropbox/dropbox-sdk-python/blob/master/example/back-up-and-restore/backup-and-res...

 

On my Mac ist works flawlessly. But when I run the very same code on my Windows server 2018 R2 it throws the follwoing error. Python is the same version - 3.5.2. Any ideas are more than welcome.

 

C:\Users\Administrator\Documents\scripts\web2dropbox>python www2dropbox.py

Creating a Dropbox object...
upload file JTL-20180331.tar.bz2 to Dropbox /JTL-20180331.tar.bz2
Uploading ./temp/JTL-20180331.tar.bz2 to Dropbox as /JTL-20180331.tar.bz2...
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\urllib3\connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\urllib3\connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\c
lient.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\c
lient.py", line 1151, in _send_request
    self.endheaders(body)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\c
lient.py", line 1102, in endheaders
    self._send_output(message_body)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\c
lient.py", line 936, in _send_output
    self.send(message_body)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\c
lient.py", line 908, in send
    self.sock.sendall(data)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\ssl.py
", line 891, in sendall
    v = self.send(data[count)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\ssl.py
", line 861, in send
    return self._sslobj.write(data)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\ssl.py
", line 586, in write
    return self._sslobj.write(data)
socket.timeout: The write operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\requests\adapters.py", line 440, in send
    timeout=timeout
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\urllib3\connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\urllib3\util\retry.py", line 357, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\urllib3\packages\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\urllib3\connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\urllib3\connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\c
lient.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\c
lient.py", line 1151, in _send_request
    self.endheaders(body)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\c
lient.py", line 1102, in endheaders
    self._send_output(message_body)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\c
lient.py", line 936, in _send_output
    self.send(message_body)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\http\c
lient.py", line 908, in send
    self.sock.sendall(data)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\ssl.py
", line 891, in sendall
    v = self.send(data[count)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\ssl.py
", line 861, in send
    return self._sslobj.write(data)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\ssl.py
", line 586, in write
    return self._sslobj.write(data)
urllib3.exceptions.ProtocolError: ('Connection aborted.', timeout('The write ope
ration timed out',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "www2dropbox.py", line 186, in <module>
    main()
  File "www2dropbox.py", line 180, in main
    backup2dbx(dbx, local_filename, backup_path + filename)
  File "www2dropbox.py", line 27, in backup2dbx
    dbx.files_upload(f.read(), backup_path, mode=WriteMode('overwrite'))
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\dropbox\base.py", line 2125, in files_upload
    f,
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\dropbox\dropbox.py", line 272, in request
    timeout=timeout)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\dropbox\dropbox.py", line 363, in request_json_string_with_retry
    timeout=timeout)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\dropbox\dropbox.py", line 447, in request_json_string
    timeout=timeout,
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\requests\sessions.py", line 555, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\requests\sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\requests\sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-p
ackages\requests\adapters.py", line 490, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', timeout('The write
operation timed out',))

C:\Users\Administrator\Documents\scripts\web2dropbox>

Many Thanks,

 

Meister

1 Accepted Solution

Accepted Solutions
Highlighted

Re: socket.timeout: The write operation timed out

Dropboxer
Dropboxer

Thanks! The single files_upload method used in that sample is only meant for files up to 150 MB in size. That isn't necessarily a strict limit though, so files larger than that may or may not fail, and it may be inconsistent across different machines/network connections. For large files, you'll need to switch to upload sessions.

View solution in original post

4 Replies 4
Highlighted

Re: socket.timeout: The write operation timed out

Dropboxer
Dropboxer

How big is the file you're trying to upload when this occurs? The sample doesn't use upload sessions, so it can only handle small files. If you need it to support large files, you'll need to update it to use upload sessions.

 

Otherwise, this might just indicate transient server/network issues. If you're still seeing this, there may be something interfering with your connection. Do you have anything on that network connection, e.g., firewall or proxy, that may be preventing your app from successfully connecting to the Dropbox servers?

Highlighted

Re: socket.timeout: The write operation timed out

Explorer | Level 3

The file is 250-300MB. As mentioned, it worked on my Mac on which I tested the script first with the same file. The datapath is identical and local firewall on the windows server is switched off

Highlighted

Re: socket.timeout: The write operation timed out

Dropboxer
Dropboxer

Thanks! The single files_upload method used in that sample is only meant for files up to 150 MB in size. That isn't necessarily a strict limit though, so files larger than that may or may not fail, and it may be inconsistent across different machines/network connections. For large files, you'll need to switch to upload sessions.

View solution in original post

Highlighted

Re: socket.timeout: The write operation timed out

Explorer | Level 3

Tried with a smaller file and it worked. 

With that error messages it never occured to me that filsize might be the issue.

 

Many thanks for your support!

Polls
Do you know how to organize your files and folders?
We have created a guide on folder best practice, so you can get organized now check it out here.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?