Skip to content

Commit 74a186a

Browse files
committed
Only attempt to load libsedml (and warn if not present) if using it
1 parent 6816315 commit 74a186a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pyneuroml/utils/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@
3535
logger = logging.getLogger(__name__)
3636
logger.setLevel(logging.INFO)
3737

38-
try:
39-
import libsedml
40-
except ModuleNotFoundError:
41-
logger.warning("Please install optional dependencies to use SED-ML features:")
42-
logger.warning("pip install pyneuroml[combine]")
43-
4438

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

723717
elif rootfile.endswith(".sedml"):
718+
719+
try:
720+
import libsedml
721+
except ModuleNotFoundError:
722+
logger.error("Please install optional dependencies to use SED-ML features:")
723+
logger.error("pip install pyneuroml[combine]")
724+
724725
if pathlib.Path(rootfile).is_absolute():
725726
rootdoc = libsedml.readSedMLFromFile(rootfile)
726727
else:

0 commit comments

Comments
 (0)