From 60968fa2597168f8e9a7e408b28da914d083d3c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Wed, 20 Dec 2017 18:14:48 +0100 Subject: [PATCH] py3: store exception variables for use outside except In python3 exceptions aren't defined outside the except block. Leading to 'UnboundLocalError: local variable 'e' referenced before assignment' errors. To work around this, store the local variable into one that will have a longer life. --- virtManager/connection.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/virtManager/connection.py b/virtManager/connection.py index c98fff3d1..f9da6677a 100644 --- a/virtManager/connection.py +++ b/virtManager/connection.py @@ -1439,7 +1439,8 @@ class vmmConnection(vmmGObject): self._tick(*args, **kwargs) except KeyboardInterrupt: raise - except Exception as e: + except Exception as err: + e = err pass if e is None: