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.
This commit is contained in:
Cédric Bosdonnat 2017-12-20 18:14:48 +01:00 committed by Cole Robinson
parent ca3c3a5869
commit 60968fa259

View File

@ -1439,7 +1439,8 @@ class vmmConnection(vmmGObject):
self._tick(*args, **kwargs) self._tick(*args, **kwargs)
except KeyboardInterrupt: except KeyboardInterrupt:
raise raise
except Exception as e: except Exception as err:
e = err
pass pass
if e is None: if e is None: