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 for execute_shell_popen using WORKING_DIRECTORY

Eugene Zolenkoa88113de33c8
diff --git a/autogpt/commands/execute_code.py b/autogpt/commands/execute_code.py
index a524081e0f..95ba612264 100644
--- a/autogpt/commands/execute_code.py
+++ b/autogpt/commands/execute_code.py
@@ -125,10 +125,9 @@ def execute_shell_popen(command_line) -> str:
str: Description of the fact that the process started and its id
"""
current_dir = os.getcwd()
-
- if WORKING_DIRECTORY not in current_dir: # Change dir into workspace if necessary
- work_dir = os.path.join(os.getcwd(), WORKING_DIRECTORY)
- os.chdir(work_dir)
+ # Change dir into workspace if necessary
+ if str(WORKSPACE_PATH) not in current_dir:
+ os.chdir(WORKSPACE_PATH)
print(f"Executing command '{command_line}' in working directory '{os.getcwd()}'")