mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 06:24:20 +01:00
Changes python version to 3.10 in execute_code.
This commit is contained in:
@@ -5,6 +5,8 @@ import os
|
|||||||
def execute_python_file(file):
|
def execute_python_file(file):
|
||||||
workspace_folder = "auto_gpt_workspace"
|
workspace_folder = "auto_gpt_workspace"
|
||||||
|
|
||||||
|
print (f"Executing file '{file}' in workspace '{workspace_folder}'")
|
||||||
|
|
||||||
if not file.endswith(".py"):
|
if not file.endswith(".py"):
|
||||||
return "Error: Invalid file type. Only .py files are allowed."
|
return "Error: Invalid file type. Only .py files are allowed."
|
||||||
|
|
||||||
@@ -20,7 +22,7 @@ def execute_python_file(file):
|
|||||||
# You can find available Python images on Docker Hub:
|
# You can find available Python images on Docker Hub:
|
||||||
# https://hub.docker.com/_/python
|
# https://hub.docker.com/_/python
|
||||||
container = client.containers.run(
|
container = client.containers.run(
|
||||||
'python:3.8',
|
'python:3.10',
|
||||||
f'python {file}',
|
f'python {file}',
|
||||||
volumes={
|
volumes={
|
||||||
os.path.abspath(workspace_folder): {
|
os.path.abspath(workspace_folder): {
|
||||||
@@ -36,6 +38,9 @@ def execute_python_file(file):
|
|||||||
logs = container.logs().decode('utf-8')
|
logs = container.logs().decode('utf-8')
|
||||||
container.remove()
|
container.remove()
|
||||||
|
|
||||||
|
# print(f"Execution complete. Output: {output}")
|
||||||
|
# print(f"Logs: {logs}")
|
||||||
|
|
||||||
return logs
|
return logs
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user