Fehler implementieren MCP Python Sandbox mit Asyncio unter Windows: NotimplementedErrorPython

Python-Programme
Anonymous
 Fehler implementieren MCP Python Sandbox mit Asyncio unter Windows: NotimplementedError

Post by Anonymous »

Ich versuche, ein MCP Python Sandbox zu implementieren, damit mein Agent die Python -Skripte ausführt, aber ich bekomme solche Fehler:
File "C:\\Users\\f\\anaconda3\\Lib\\asyncio\\base_events.py", line 524, in _make_subprocess_transport
raise NotImplementedError
< /code>
Dies ist das Tool, das ich erstellen möchte (mit MCP Run-Python-Tool): < /p>
self.server_params = StdioServerParameters(
command='deno',
args=[
'run',
'-N', '-R=node_modules',
'-W=node_modules',
'--node-modules-dir=auto',
'jsr:@pydantic/mcp-run-python',
'stdio'
]
)`

@self.agent.tool
async def execute_script(ctx: RunContext, code: str) -> Dict[str, Any]:
async with stdio_client(self.server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
result = await session.call_tool("run_python", {"code": code})
if result.get("success"):
return {"status": "success", "output": result.get("stdout")}
raise RuntimeError(f"Error during execution: {result.get('stderr', Unknown error')}")`
< /code>
Der Fehler scheint mit der Asyncio-Ereignisschleife zusammenhängen.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post