mirror of
https://github.com/AstrBotDevs/AstrBot.git
synced 2026-09-24 16:39:52 +08:00
fix: encoding issue in windows when using python tool
This commit is contained in:
@@ -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": []},
|
||||
|
||||
Reference in New Issue
Block a user