From 65b10bcaf78c8428210222084cef70ec57bdf61a Mon Sep 17 00:00:00 2001 From: Lucas Vinicius Hartmann Date: Wed, 13 Sep 2023 23:46:42 -0300 Subject: [PATCH] Drop TextIOWrapper in favor of bytes.decode(). --- webserver/openplc.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/webserver/openplc.py b/webserver/openplc.py index df3a4a5..28394b7 100644 --- a/webserver/openplc.py +++ b/webserver/openplc.py @@ -5,7 +5,6 @@ import errno import time from threading import Thread from queue import Queue, Empty -import io intervals = ( ('weeks', 604800), # 60 * 60 * 24 * 7 @@ -37,7 +36,7 @@ class NonBlockingStreamReader: Usually a process' stdout or stderr. ''' - self._s = io.TextIOWrapper(stream, encoding='utf-8') + self._s = stream self._q = Queue() def _populateQueue(stream, queue): @@ -47,7 +46,7 @@ class NonBlockingStreamReader: #while True: while (self.end_of_stream == False): - line = stream.readline() + line = stream.readline().decode('utf-8') if line: queue.put(line) if "Compilation finished with errors!" in line or "Compilation finished successfully!" in line: