diff --git a/pyrelacs/repros/repros.py b/pyrelacs/repros/repros.py index 11c657f..3067e09 100644 --- a/pyrelacs/repros/repros.py +++ b/pyrelacs/repros/repros.py @@ -8,9 +8,9 @@ import nixio as nix import importlib.util from pyrelacs.util.logging import config_logging + log = config_logging() -from IPython import embed class Repro: """ @@ -25,7 +25,6 @@ class Repro: def run_repro( self, nix_file: nix.File, name: str, file: pathlib.Path, *args, **kwargs ) -> None: - spec = importlib.util.spec_from_file_location("rep", file) if not spec: log.error("Could not load the file") @@ -35,7 +34,10 @@ class Repro: log.error("Could not load the module of the repro") else: sys.modules[name] = module - spec.loader.exec_module(module) + if spec.loader is not None: + spec.loader.exec_module(module) + else: + log.error(f"{spec.loader} is None") if hasattr(module, name): rep_class = getattr(module, name) rep_class.run(nix_file)