0

I run a Python script that runs for a couple of hours and then throws the below error. I understand it states a connection issue but if that is the case, the connection would have fallen through in the initial runs itself. Is there a way that I could avoid this error.

 Traceback (most recent call last):
 File "C:\Users\s5331866\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\connection.py", line 141, in _new_conn(self.host, self.port), self.timeout, **extra_kw)
 File "C:\Users\s5331866\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\util\connection.py", line 83, in create_connection
raise err
 File "C:\Users\s5331866\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
 sock.connect(sa)
 TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
user3447653
  • 3,968
  • 12
  • 58
  • 100
  • 2
    Add a handler for your `try/except` block for `TimeoutError`. You cannot completely avoid `ConnectionError` or `TimeoutError` as your program relies on the responses from the other party, which you cannot control. The only thing you can control is what to do when you encounter these errors. – r.ook Jan 16 '18 at 18:44
  • Possible duplicate of [this](https://stackoverflow.com/questions/14143198/errno-10060-a-connection-attempt-failed-because-the-connected-party-did-not-pro) – kingJulian Jan 16 '18 at 18:50

0 Answers0