Skip to content
Snippets Groups Projects
Commit ee0ae1a2 authored by Elias Chetouane's avatar Elias Chetouane
Browse files

Remplacement de l'appel système par un appel à subrocess (plus stable et plus...

Remplacement de l'appel système par un appel à subrocess (plus stable et plus d'options) -> à tester
parent b4deb033
No related branches found
No related tags found
No related merge requests found
import subprocess
import os
""" """
v2 v2
...@@ -13,7 +11,7 @@ def execute_python_file(file_path): ...@@ -13,7 +11,7 @@ def execute_python_file(file_path):
excute a py program from a file_path excute a py program from a file_path
""" """
try : try :
os.system(f'python {file_path}') subprocess.run(['python', file_path])
except FileNotFoundError: except FileNotFoundError:
print(f"Error: The file '{file_path}' does not exist.") print(f"Error: The file '{file_path}' does not exist.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment