Skip to content

Commit

Permalink
Fix execute_python_file workspace mount & Windows path formatting (S…
Browse files Browse the repository at this point in the history
…ignificant-Gravitas#4996)

* fix for Significant-Gravitas#4975

* Add TODO based on code comment.

* Use builtin `Path.as_posix()`

* Remove TODO

---------

Co-authored-by: Reinier van der Leer <[email protected]>
  • Loading branch information
sohrabsaran and Pwuts authored Jul 17, 2023
1 parent 5ae044f commit a758ace
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions autogpt/commands/execute_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,14 @@ def execute_python_file(filename: str, agent: Agent) -> str:
logger.debug(f"Running {file_path} in a {image_name} container...")
container: DockerContainer = client.containers.run(
image_name,
["python", str(file_path.relative_to(agent.workspace.root))],
[
"python",
file_path.relative_to(agent.workspace.root).as_posix(),
],
volumes={
agent.config.workspace_path: {
"bind": "/workspace",
"mode": "ro",
"mode": "rw",
}
},
working_dir="/workspace",
Expand Down

0 comments on commit a758ace

Please sign in to comment.