Update execute_code.py

Just import path from OS library.
This commit is contained in:
Andres Caicedo
2023-04-04 11:31:20 +02:00
parent 1632f7ebf6
commit d450ac3a0b

View File

@@ -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: