From e3d35b2fb95501f33bf0b930f90317fc4e8aef53 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Wed, 11 Oct 2017 12:36:02 +0100 Subject: [PATCH] tests: cli: Handle UnicodeError when logging --- virtinst/cli.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/virtinst/cli.py b/virtinst/cli.py index 111dfb61..b506b4e8 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -132,6 +132,8 @@ class VirtStreamHandler(logging.StreamHandler): self.flush() except (KeyboardInterrupt, SystemExit): raise + except (UnicodeError, TypeError): + stream.write((fs % msg).encode("utf-8")) except Exception: self.handleError(record)