From 1569be9ba7e6a1835c12b370aec45ac07400e189 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Fri, 14 Dec 2018 15:18:43 +0000 Subject: [PATCH] trace/serial_trace: Ensure markers are encoded to before writing. To be compatible with Python3 ensure that start and stop markers are encoded before writing. --- devlib/trace/serial_trace.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/devlib/trace/serial_trace.py b/devlib/trace/serial_trace.py index 227efbb..b991a54 100644 --- a/devlib/trace/serial_trace.py +++ b/devlib/trace/serial_trace.py @@ -52,7 +52,8 @@ class SerialTraceCollector(TraceCollector): self._tmpfile = NamedTemporaryFile() - self._tmpfile.write("-------- Starting serial logging --------\n") + start_marker = "-------- Starting serial logging --------\n" + self._tmpfile.write(start_marker.encode('utf-8')) self._serial_target, self._conn = get_connection(port=self.serial_port, baudrate=self.baudrate, @@ -76,7 +77,8 @@ class SerialTraceCollector(TraceCollector): self._serial_target.close() del self._conn - self._tmpfile.write("-------- Stopping serial logging --------\n") + stop_marker = "-------- Stopping serial logging --------\n" + self._tmpfile.write(stop_marker.encode('utf-8')) self._collecting = False