Skip to content
Snippets Groups Projects
Verified Commit c1a789e1 authored by Xavier Robin's avatar Xavier Robin
Browse files

feat: SCHWED-5913 make invalid $OST_COMPOUNDS_CHEMLIB an error

parent df8c9696
No related branches found
No related tags found
No related merge requests found
...@@ -87,15 +87,14 @@ def _SetupCompoundsLib(): ...@@ -87,15 +87,14 @@ def _SetupCompoundsLib():
""" """
# Try with the $OST_COMPOUNDS_CHEMLIB environment variable # Try with the $OST_COMPOUNDS_CHEMLIB environment variable
compound_lib_path = os.getenv("OST_COMPOUNDS_CHEMLIB") compound_lib_path = os.getenv("OST_COMPOUNDS_CHEMLIB")
try: if compound_lib_path:
_TrySetCompoundsLib(compound_lib_path) compound_lib = conop.CompoundLib.Load(compound_lib_path)
except ValueError: if compound_lib is None:
if compound_lib_path: raise RuntimeError("Could not load $OST_COMPOUNDS_CHEMLIB as a compound "
LogWarning("Could not load $OST_COMPOUNDS_CHEMLIB as a compound library" "library: '%s'." % compound_lib_path)
": '%s'. Falling back to default." % ( compound_lib_path)) else:
pass conop.SetDefaultLib(compound_lib)
else: return
return
# Try from GetSharedDataPath() - requires $OST_ROOT to be set. # Try from GetSharedDataPath() - requires $OST_ROOT to be set.
try: try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment