From 61812ac32a96b06497e2d646a60b0a2f349f1937 Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Thu, 5 Sep 2024 22:57:35 +0200 Subject: [PATCH] Untested code that may fix the following: Exception in thread Thread-2 (forward_text_lines): Traceback (most recent call last): File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner self.run() File "/usr/lib/python3.12/threading.py", line 1010, in run self._target(*self._args, **self._kwargs) File "/app/venv/lib/python3.12/site-packages/socrate/system.py", line 155, in forward_text_lines current_line = src.readline() ^^^^^^^^^^^^^^ File "", line 322, in decode UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa8 in position 166: invalid start byte This was reported in #3398 --- core/base/libs/socrate/socrate/system.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/base/libs/socrate/socrate/system.py b/core/base/libs/socrate/socrate/system.py index 8ea770a3..c5046f4c 100644 --- a/core/base/libs/socrate/socrate/system.py +++ b/core/base/libs/socrate/socrate/system.py @@ -158,7 +158,7 @@ def forward_text_lines(src, dst): # runs a process and passes its standard/error output to the standard/error output of the current python script def run_process_and_forward_output(cmd): - process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding='utf-8') stdout_thread = threading.Thread(target=forward_text_lines, args=(process.stdout, sys.stdout)) stdout_thread.daemon = True