From 5e9be12f92d6b562bbb0bc220b7b03c54584b129 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Wed, 20 Sep 2017 15:49:30 +0800 Subject: [PATCH] bugfix: UnicodeEncodeError in 3.4+ --- ate/utils.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ate/utils.py b/ate/utils.py index 9b732c3f..f8145757 100644 --- a/ate/utils.py +++ b/ate/utils.py @@ -369,7 +369,13 @@ def print_output(output): print('{:<16}: {:<}'.format("--------", "-----")) for variable, value in output.items(): - print('{:<16}: {:<}'.format( - variable.encode("utf-8"), value.encode("utf-8"))) + + if PYTHON_VERSION == 2: + if isinstance(variable, unicode): + variable = variable.encode("utf-8") + if isinstance(value, unicode): + value = value.encode("utf-8") + + print('{:<16}: {:<}'.format(variable, value)) print("============================================\n")