From f693871c5842a95ee93e955a551f47c9688079cf Mon Sep 17 00:00:00 2001 From: Arata Notsu Date: Mon, 1 Jun 2015 16:32:38 +0900 Subject: [PATCH] Avoid UnboundLocalError for exc Previously exc was set only when an exception occurs in the inner try (the one contains call to self.poll), so an error in the other part causes an UnboundLocalError. Closes #178 --- websockify/websocket.py | 1 + 1 file changed, 1 insertion(+) diff --git a/websockify/websocket.py b/websockify/websocket.py index 1cbf583..c45255c 100644 --- a/websockify/websocket.py +++ b/websockify/websocket.py @@ -1047,6 +1047,7 @@ class WebSocketServer(object): self.msg("In exit") break except Exception: + exc = sys.exc_info()[1] self.msg("handler exception: %s", str(exc)) self.vmsg("exception", exc_info=True)