From 035c15737356b64f9f10ab6b8d46782269d41068 Mon Sep 17 00:00:00 2001 From: Holly Le Heux Date: Sun, 9 Jun 2019 14:12:16 +0100 Subject: [PATCH] Fix issue with output encoding Prevents the error: UnicodeEncodeError: 'ascii' codec can't encode characters --- pidcat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidcat.py b/pidcat.py index efaa078..8d04daa 100755 --- a/pidcat.py +++ b/pidcat.py @@ -302,7 +302,7 @@ def tag_in_tags_regex(tag, tags): linebuf += colorize(' ' * (header_size - 1), bg=WHITE) linebuf += ' PID: %s UID: %s GIDs: %s' % (line_pid, line_uid, line_gids) linebuf += '\n' - print(linebuf) + print(linebuf.encode('utf-8')) last_tag = None # Ensure next log gets a tag printed dead_pid, dead_pname = parse_death(tag, message) @@ -312,7 +312,7 @@ def tag_in_tags_regex(tag, tags): linebuf += colorize(' ' * (header_size - 1), bg=RED) linebuf += ' Process %s (PID: %s) ended' % (dead_pname, dead_pid) linebuf += '\n' - print(linebuf) + print(linebuf.encode('utf-8')) last_tag = None # Ensure next log gets a tag printed # Make sure the backtrace is printed after a native crash