Fix execute_python_file workspace mount & Windows path formatting (#4996)

* fix for #4975

* Add TODO based on code comment.

* Use builtin `Path.as_posix()`

* Remove TODO

---------

Co-authored-by: Reinier van der Leer <github@pwuts.nl>
This commit is contained in:
Sohrab Saran
2023-07-17 23:54:47 +05:30
committed by GitHub
parent 5ae044f53d
commit a758acef2c

View File

@@ -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",