Python 3.3+Exceptionsexception
ConnectionResetError
built-in exceptions
The connection was reset by the peer (a subclass of ConnectionError).
Syntax
raise ConnectionResetError
This is the ECONNRESET errno: the peer tore down an already-established connection with an RST — it crashed, restarted, or a proxy dropped an idle keep-alive. The common mistake is assuming the request never went through: bytes may already have been sent and received, so think about whether the operation is idempotent before retrying. Writing into such a socket often raises BrokenPipeError instead.
Examples
try:
raise ConnectionResetError
except ConnectionResetError as e:
print(type(e).__name__) # → ConnectionResetError
See also
Open in the full glossarydocs.python.orgReport an inaccuracy