From 59918b9dbc5ce68641273ea3f1cec31c8c77466d Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Wed, 3 Aug 2022 14:53:14 +0200 Subject: [PATCH] Core: patch stream_input to ignore non-parsable input (such as EOF encoded as 0xff) (#854) --- Utils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Utils.py b/Utils.py index 423bb3b4..4d3d6b13 100644 --- a/Utils.py +++ b/Utils.py @@ -479,9 +479,13 @@ def init_logging(name: str, loglevel: typing.Union[str, int] = logging.INFO, wri def stream_input(stream, queue): def queuer(): while 1: - text = stream.readline().strip() - if text: - queue.put_nowait(text) + try: + text = stream.readline().strip() + except UnicodeDecodeError as e: + logging.exception(e) + else: + if text: + queue.put_nowait(text) from threading import Thread thread = Thread(target=queuer, name=f"Stream handler for {stream.name}", daemon=True)