Skip to content

Commit 7cf1bba

Browse files
run: guard against not finding config programs
1 parent c7f75e4 commit 7cf1bba

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/pybdsim/Run.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -551,16 +551,22 @@ def __init__(self):
551551
self.clhep_version = self._find_clhep_version()
552552

553553
def _find_root_version(self) :
554-
result = _subprocess.run(["root-config","--version"], capture_output=True, text=True)
555-
return result.stdout.strip()
554+
try :
555+
result = _subprocess.run(["root-config","--version"], capture_output=True, text=True)
556+
return result.stdout.strip()
557+
except Exception:
558+
return "Not found"
556559

557560
def _find_geant4_version(self) :
558-
result = _subprocess.run(["geant4-config","--version"], capture_output=True, text=True)
559-
return result.stdout.strip()
561+
try :
562+
result = _subprocess.run(["geant4-config","--version"], capture_output=True, text=True)
563+
return result.stdout.strip()
564+
except Exception:
565+
return "Not found"
560566

561567
def _find_clhep_version(self) :
562568
try :
563569
result = _subprocess.run(["clhep-config","--version"], capture_output=True, text=True)
564570
return result.stdout.split()[1].strip()
565-
except :
571+
except Exception:
566572
return "Not found"

0 commit comments

Comments
 (0)