Commit 530eac0c authored by Jonas Kaufmann's avatar Jonas Kaufmann Committed by Antoine Kaufmann
Browse files

run.py: throw exceptions instead of working with None

parent cbd825e1
......@@ -308,8 +308,15 @@ if not args.pickled:
for path in args.experiments:
modname, _ = os.path.splitext(os.path.basename(path))
class ExperimentModuleLoadError(Exception):
pass
spec = importlib.util.spec_from_file_location(modname, path)
if spec is None:
raise ExperimentModuleLoadError('spec is None')
mod = importlib.util.module_from_spec(spec)
if spec.loader is None:
raise ExperimentModuleLoadError('spec.loader is None')
spec.loader.exec_module(mod)
experiments += mod.experiments
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment