From cee77181d025ea2f72c37f61abaad0aa53252dc4 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Sun, 13 Aug 2017 15:20:59 +0100 Subject: [PATCH] Made logger convert output to utf-8 including errors This prevents a regular error in the python2 build where the output is in byte format but is not valid utf-8, so the logger crashes because the format is wrong. --- pythonforandroid/logger.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pythonforandroid/logger.py b/pythonforandroid/logger.py index 93c086f821..64d5f2c452 100644 --- a/pythonforandroid/logger.py +++ b/pythonforandroid/logger.py @@ -174,6 +174,8 @@ def shprint(command, *args, **kwargs): output = command(*args, **kwargs) for line in output: if logger.level > logging.DEBUG: + if isinstance(line, bytes): + line = line.decode('utf-8', errors='replace') msg = line.replace( '\n', ' ').replace( '\t', ' ').replace(