Skip to content

Your lightweight open-source personal agent.

fix(restart): use -m nanobot for Windows compatibility

chengyongru6ad30f12f530
diff --git a/nanobot/agent/loop.py b/nanobot/agent/loop.py
index 5fe0ee0e2..05b87284a 100644
--- a/nanobot/agent/loop.py
+++ b/nanobot/agent/loop.py
@@ -292,7 +292,9 @@ class AgentLoop:
async def _do_restart():
await asyncio.sleep(1)
- os.execv(sys.executable, [sys.executable] + sys.argv)
+ # Use -m nanobot instead of sys.argv[0] for Windows compatibility
+ # (sys.argv[0] may be just "nanobot" without full path on Windows)
+ os.execv(sys.executable, [sys.executable, "-m", "nanobot"] + sys.argv[1:])
asyncio.create_task(_do_restart())