As a follow-up to cannot-bind-to-address-after-socket-program-crashes, I was receiving this error after my program was restarted:
socket.error: [Errno
The above solution didn't work for me but this one did:
SocketServer.ThreadingTCPServer.allow_reuse_address = True server = SocketServer.ThreadingTCPServer(("localhost", port), CustomHandler) server.serve_forever()