Skip to content

Commit 32efe84

Browse files
committed
update python command
1 parent 1dafb09 commit 32efe84

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

strands_examples/nova_act_strands.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import shutil
23

34
from mcp import StdioServerParameters, stdio_client
45
from strands import Agent
@@ -8,10 +9,19 @@
89
# Step 1: Define MCP stdio parameters
910
NOVA_ACT_API_KEY = os.getenv("NOVA_ACT_API_KEY")
1011

12+
# Find the available Python command
13+
python_cmd = "python"
14+
if shutil.which("python3") is not None:
15+
python_cmd = "python3"
16+
elif shutil.which("python") is not None:
17+
python_cmd = "python"
18+
else:
19+
raise RuntimeError("Neither 'python' nor 'python3' command was found in PATH")
20+
1121
nova_act_client = MCPClient(
1222
lambda: stdio_client(
1323
StdioServerParameters(
14-
command="python",
24+
command=python_cmd,
1525
args=["nova_act_mcp_server.py"],
1626
env={"NOVA_ACT_API_KEY": NOVA_ACT_API_KEY},
1727
),

0 commit comments

Comments
 (0)