diff --git a/autogpt/commands/execute_code.py b/autogpt/commands/execute_code.py index f365cce2..8d14c17f 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 608e9630..ca173762 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())