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.

fix(agent): Fix `execute_python_file` on local storage

Reinier van der Leera7c7a5e18b7f
diff --git a/autogpts/autogpt/autogpt/commands/execute_code.py b/autogpts/autogpt/autogpt/commands/execute_code.py
index b9365b2c23..515f2d60ba 100644
--- a/autogpts/autogpt/autogpt/commands/execute_code.py
+++ b/autogpts/autogpt/autogpt/commands/execute_code.py
@@ -164,8 +164,8 @@ class CodeExecutorComponent(CommandProvider):
if not str(filename).endswith(".py"):
raise InvalidArgumentError("Invalid file type. Only .py files are allowed.")
- file_path = Path(filename)
- if not file_path.is_file():
+ file_path = self.workspace.get_path(filename)
+ if not self.workspace.exists(file_path):
# Mimic the response that you get from the command line to make it
# intuitively understandable for the LLM
raise FileNotFoundError(