From 02a687a05e3ec9aa09781682618ac737e3310c5c Mon Sep 17 00:00:00 2001 From: tmadlener Date: Wed, 14 Feb 2024 14:41:48 +0100 Subject: [PATCH] Make debugging a bit easier --- k4FWCore/python/k4FWCore/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/k4FWCore/python/k4FWCore/utils.py b/k4FWCore/python/k4FWCore/utils.py index 2acc60a9..d7f07c53 100644 --- a/k4FWCore/python/k4FWCore/utils.py +++ b/k4FWCore/python/k4FWCore/utils.py @@ -57,6 +57,9 @@ def import_from( """ filename = os.path.abspath(filename) + if not os.path.exists(filename): + raise FileNotFoundError(f"No such file: '{filename}'") + module_name = module_name or os.path.basename(filename).replace(".", "_") loader = SourceFileLoader(module_name, filename) spec = importlib.util.spec_from_loader(loader.name, loader)