Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Pass command line args as list (#1486)

Robin Richtsfeld77ee9f81195b
diff --git a/autogpt/commands/execute_code.py b/autogpt/commands/execute_code.py
index f365cce29e..8d14c17f6b 100644
--- a/autogpt/commands/execute_code.py
+++ b/autogpt/commands/execute_code.py
@@ -33,7 +33,7 @@ def execute_python_file(filename: str) -> str:
if we_are_running_in_a_docker_container():
result = subprocess.run(
- f"python {filename}", capture_output=True, encoding="utf8", shell=True
+ ["python", filename], capture_output=True, encoding="utf8"
)
if result.returncode == 0:
return result.stdout
@@ -65,7 +65,7 @@ def execute_python_file(filename: str) -> str:
logger.info(status)
container = client.containers.run(
image_name,
- f"python {Path(filename).relative_to(CFG.workspace_path)}",
+ ["python", str(Path(filename).relative_to(CFG.workspace_path))],
volumes={
CFG.workspace_path: {
"bind": "/workspace",
diff --git a/benchmark/benchmark_entrepreneur_gpt_with_difficult_user.py b/benchmark/benchmark_entrepreneur_gpt_with_difficult_user.py
index 608e9630bd..ca17376244 100644
--- a/benchmark/benchmark_entrepreneur_gpt_with_difficult_user.py
+++ b/benchmark/benchmark_entrepreneur_gpt_with_difficult_user.py
@@ -75,14 +75,13 @@ Needs improvement.
Not what I need."""
# TODO: add questions above, to distract it even more.
- command = f"{sys.executable} -m autogpt"
+ command = [sys.executable, "-m", "autogpt"]
process = subprocess.Popen(
command,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
- shell=True,
)
stdout_output, stderr_output = process.communicate(input_data.encode())