From 7811e3be5597997907a081887760f5a18798c7e7 Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Fri, 15 Sep 2023 23:28:41 +0100 Subject: [PATCH] feat(pynml): throw error if no appropriate engine is found --- pyneuroml/pynml.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyneuroml/pynml.py b/pyneuroml/pynml.py index f7bab4b53..65e9e8023 100644 --- a/pyneuroml/pynml.py +++ b/pyneuroml/pynml.py @@ -1330,11 +1330,17 @@ def run_lems_with(engine: str, *args: typing.Any, **kwargs: typing.Any): """ function_tuple = inspect.getmembers(sys.modules[__name__], inspect.isfunction) + found = False for fname, function in function_tuple: if fname.startswith("run_lems_with") and fname.endswith(engine): print(f"Running with {fname}") + found = True return function(*args, **kwargs) + if found is False: + logger.error(f"Could not find engine {engine}. Exiting.") + return False + def run_lems_with_jneuroml_neuron( lems_file_name: str,