Skip to content

Commit

Permalink
Check if the list is not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnaf-tahmid-chowdhury committed Dec 13, 2024
1 parent aeef2d6 commit 85fcfcd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions openmc/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ def load_openmc_library():
try:
# Attempt to load the library from OpenMC
import openmc
_filename = openmc.lib[0]
if os.path.isfile(_filename):
if openmc.lib:
_filename = openmc.lib[0]
return CDLL(str(_filename))
raise FileNotFoundError
except (IndexError, FileNotFoundError):
# Attempt to load the library from the installed module
import importlib
openmc = importlib.import_module("openmc")
_filename = openmc.lib[0]
if os.path.isfile(_filename):
if openmc.lib:
_filename = openmc.lib[0]
warnings.warn(
"It seems OpenMC is being run from its source directory. "
"This setup is not recommended as it may lead to unexpected behavior, "
Expand Down

0 comments on commit 85fcfcd

Please sign in to comment.