mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
Update execute_code.py
Just import path from OS library.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import docker
|
import docker
|
||||||
import os
|
from os import path
|
||||||
|
|
||||||
|
|
||||||
def execute_python_file(file):
|
def execute_python_file(file):
|
||||||
@@ -11,9 +11,9 @@ def execute_python_file(file):
|
|||||||
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."
|
||||||
|
|
||||||
file_path = os.path.join(workspace_folder, file)
|
file_path = path.join(workspace_folder, file)
|
||||||
|
|
||||||
if not os.path.isfile(file_path):
|
if not path.isfile(file_path):
|
||||||
return f"Error: File '{file}' does not exist."
|
return f"Error: File '{file}' does not exist."
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user