Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
fix(tool): fix the bug of `execute_python_code` in Win by setting utf-8 environment (#916)
Eric Shaw8299e1ba50c3
diff --git a/src/agentscope/tool/_coding/_python.py b/src/agentscope/tool/_coding/_python.pyindex 0a6d5581e..d9f58976c 100644--- a/src/agentscope/tool/_coding/_python.py+++ b/src/agentscope/tool/_coding/_python.py@@ -40,12 +40,16 @@ async def execute_python_code(with open(temp_file, "w", encoding="utf-8") as f:f.write(code)+ env = os.environ.copy()+ env["PYTHONUTF8"] = "1"+ env["PYTHONIOENCODING"] = "utf-8"proc = await asyncio.create_subprocess_exec(sys.executable,"-u",temp_file,stdout=asyncio.subprocess.PIPE,stderr=asyncio.subprocess.PIPE,+ env=env,)try: