From adccf18f13ac81ebf2bf696e962cb12d70c4c0b5 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 4 Dec 2017 10:47:09 -0500 Subject: [PATCH] Decode stderr bytes before logging --- pysipp/report.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pysipp/report.py b/pysipp/report.py index 9643892..44ec4f5 100644 --- a/pysipp/report.py +++ b/pysipp/report.py @@ -47,9 +47,11 @@ def emit_logfiles(agents2procs, level='warn', max_lines=100): emit = getattr(log, level) for ua, proc in agents2procs: - # print stderr - emit("stderr for '{}' @ {}\n{}\n".format( - ua.name, ua.srcaddr, proc.streams.stderr)) + # log stderr + stderr = proc.streams.stderr # bytes in py3 + stderr = stderr.decode() if isinstance(stderr, bytes) else stderr + emit("stderr for '{}' @ {}\n{}\n".format(ua.name, ua.srcaddr, stderr)) + # FIXME: no idea, but some logs are not being printed without this # logging mod bug? time.sleep(0.01)