[elbe-devel] [PATCH] Prevent UnicodeEncodeError on initvm creation

bage at linutronix.de bage at linutronix.de
Sat Feb 1 10:22:22 CET 2020


From: Bastian Germann <bage at linutronix.de>

4643a4e8bf1("Python3: harmonize binary/unicode strings") introduced a bytes to
string conversion in elbepack.log that makes initvm creation throw a
UnicodeEncodeError (that is ignored) with Python 2.  Remove that conversion.

I successfully built some examples with Python 3 and it seems the former change
is unnecessary at this point.

Signed-off-by: Bastian Germann <bage at linutronix.de>
---
 elbepack/log.py | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/elbepack/log.py b/elbepack/log.py
index bffc6c1d4..f17df9e71 100644
--- a/elbepack/log.py
+++ b/elbepack/log.py
@@ -11,8 +11,6 @@ import select
 import threading
 from contextlib import contextmanager
 
-from io import TextIOWrapper, BytesIO
-
 root = logging.getLogger()
 root.setLevel(logging.DEBUG)
 local = threading.local()
@@ -257,8 +255,6 @@ class AsyncLogging(object):
             if not rest:
                 break
 
-        rest = TextIOWrapper(BytesIO(rest), encoding='utf-8', errors='replace').read()
-
         if self.lines:
             self.lines[-1] += rest
             self.block.info("\n".join(self.lines))
-- 
2.20.1




More information about the elbe-devel mailing list