I am trying to catch this particular exception (and only this exception) in Python 2.7, but I can't seem to find documentation on the exception class. Is there one?
[Errno 10054] An existing connection was forcibly closed by the remote host
My code so far:
try:
# Deleting filename
self.ftp.delete(filename)
return True
except (error_reply, error_perm, error_temp):
return False
except # ?? What goes here for Errno 10054 ??
reconnect()
retry_action()
The 10054 error is raised by the Operating System and reports that an existing connection was forcibly closed by the remote host. You should look at the workload on the execution servers at that location and check the Windows event logs for errors or other activity around the time of the failures.
The error type is socket.error, the documentation is here. Try modiffying your code like this:
import socket
import errno
try:
Deleting filename
self.ftp.delete(filename)
return True
except (error_reply, error_perm, error_temp):
return False
except socket.error as error:
if error.errno == errno.WSAECONNRESET:
reconnect()
retry_action()
else:
raise
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With