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.

Disable bytecode generation for python execution commands

Reinier van der Leer3c48c4a2d61c
diff --git a/autogpt/commands/execute_code.py b/autogpt/commands/execute_code.py
index 98500cf798..77a678b6d6 100644
--- a/autogpt/commands/execute_code.py
+++ b/autogpt/commands/execute_code.py
@@ -122,7 +122,7 @@ def execute_python_file(filename: Path, agent: Agent) -> str:
f"Auto-GPT is running in a Docker container; executing {file_path} directly..."
)
result = subprocess.run(
- ["python", str(file_path)],
+ ["python", "-B", str(file_path)],
capture_output=True,
encoding="utf8",
cwd=agent.config.workspace_path,
@@ -162,6 +162,7 @@ def execute_python_file(filename: Path, agent: Agent) -> str:
image_name,
[
"python",
+ "-B",
file_path.relative_to(agent.workspace.root).as_posix(),
],
volumes={