8000 logger: fix encoding issue for python 2 only · peterdocter/python-for-android@68b464c · GitHub
[go: up one dir, main page]

Skip to content

Commit 68b464c

Browse files
committed
logger: fix encoding issue for python 2 only
1 parent 6beac27 commit 68b464c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pythonforandroid/logger.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
from math import log10
88
from collections import defaultdict
99
from colorama import Style as Colo_Style, Fore as Colo_Fore
10+
import six
1011

1112
# This codecs change fixes a bug with log output, but crashes under python3
12-
# import codecs
1 6861 3-
# stdout = codecs.getwriter('utf8')(stdout)
14-
# stderr = codecs.getwriter('utf8')(stderr)
13+
if not six.PY3:
14+
import codecs
15+
stdout = codecs.getwriter('utf8')(stdout)
16+
stderr = codecs.getwriter('utf8')(stderr)
1517

1618
# monkey patch to show full output
1719
sh.ErrorReturnCode.truncate_cap = 999999

0 commit comments

Comments
 (0)
0