Skip to content

Commit

Permalink
Only attempt to load libsedml (and warn if not present) if using it
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Sep 24, 2024
1 parent 6816315 commit 74a186a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pyneuroml/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

try:
import libsedml
except ModuleNotFoundError:
logger.warning("Please install optional dependencies to use SED-ML features:")
logger.warning("pip install pyneuroml[combine]")


MAX_COLOUR = (255, 0, 0) # type: typing.Tuple[int, int, int]
MIN_COLOUR = (255, 255, 0) # type: typing.Tuple[int, int, int]
Expand Down Expand Up @@ -721,6 +715,13 @@ def get_model_file_list(
lems_def_dir = get_model_file_list(inc, filelist, rootdir, lems_def_dir)

elif rootfile.endswith(".sedml"):

try:
import libsedml
except ModuleNotFoundError:
logger.error("Please install optional dependencies to use SED-ML features:")
logger.error("pip install pyneuroml[combine]")

if pathlib.Path(rootfile).is_absolute():
rootdoc = libsedml.readSedMLFromFile(rootfile)
else:
Expand Down

0 comments on commit 74a186a

Please sign in to comment.