Skip to content
Snippets Groups Projects
Commit 50970130 authored by Simon Hermanns's avatar Simon Hermanns
Browse files

Catched exception from subprocess

parent 39a73db0
No related branches found
No related tags found
1 merge request!383Resolve "Delete `fix` in path-options of tracking"
Pipeline #170956 passed
......@@ -18,13 +18,23 @@ pet_files = []
def open_pet_file(pet_file: str, build_dir: str) -> None:
process = subprocess.run([f"{build_dir}/petrack", "-project", pet_file, "-autoSave", pet_file, "-platform", "offscreen"])
if process.returncode != 0:
# try calling petrack.exe
process = subprocess.Popen(["petrack.exe", "-project", pet_file, "-autoSave", pet_file])
if process.returncode != 0:
print("Cannot open petrack. Check if you have given the right build dir or if petrack is in your PATH")
executables = [
f"{build_dir}/petrack",
"petrack.exe"
"petrack"
]
for exe in executables:
try:
process = subprocess.run([exe, "-project", pet_file, "-autoSave", pet_file, "-platform", "offscreen"], check=True)
return
except FileNotFoundError:
continue # try next executable
except subprocess.CalledProcessError as e:
print(f"Error executing {exe}: {e.stderr}")
return
print("No petrack executable found. Ensure you provided the correct build directory or if petrack is in your path")
......
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