From e410adc188ffc4e2a3c772cbee2166d117c85a8e Mon Sep 17 00:00:00 2001 From: elecvoid243 <67492363+elecvoid243@users.noreply.github.com> Date: Tue, 5 May 2026 00:03:33 +0800 Subject: [PATCH] fix: encoding issue in windows when using python tool --- astrbot/core/computer/booters/local.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/astrbot/core/computer/booters/local.py b/astrbot/core/computer/booters/local.py index a34d700ad..1fb7b5cf7 100644 --- a/astrbot/core/computer/booters/local.py +++ b/astrbot/core/computer/booters/local.py @@ -150,10 +150,13 @@ class LocalPythonComponent(PythonComponent): [os.environ.get("PYTHON", sys.executable), "-c", code], timeout=timeout, capture_output=True, - text=True, ) - stdout = "" if silent else result.stdout - stderr = result.stderr if result.returncode != 0 else "" + stdout = "" if silent else _decode_shell_output(result.stdout) + stderr = ( + _decode_shell_output(result.stderr) + if result.returncode != 0 + else "" + ) return { "data": { "output": {"text": stdout, "images": []},