From fbe6ecb88283bdef0a9d3828a95c2da8afdf8a23 Mon Sep 17 00:00:00 2001 From: NichtJens Date: Wed, 29 Oct 2025 16:57:41 +0100 Subject: [PATCH] use mod name instead of passed-in name --- sf_daq_broker/broker_manager_slow.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sf_daq_broker/broker_manager_slow.py b/sf_daq_broker/broker_manager_slow.py index c906753..4a735fd 100644 --- a/sf_daq_broker/broker_manager_slow.py +++ b/sf_daq_broker/broker_manager_slow.py @@ -249,7 +249,7 @@ class DetectorManager: code = request["code"] fn = write_code_to_file(name, code, beamline) - func = load_proc_from_file(fn, name) + func = load_proc_from_file(fn) test_run(func) # commit to git ... or delete and complain @@ -382,13 +382,15 @@ def write_code_to_file(name, code, beamline): return fn -def load_proc_from_file(fn, name): +def load_proc_from_file(fn): mod = load_module(fn) proc_func_name = "proc" - func = getattr(mod, proc_func_name, None) or getattr(mod, name, None) + mod_name = mod.__name__ + + func = getattr(mod, proc_func_name, None) or getattr(mod, mod_name, None) if func is None: - raise AttributeError(f'module "{mod.__name__}" contains neither "{proc_func_name}" nor "{name}" function') + raise AttributeError(f'module "{mod_name}" contains neither "{proc_func_name}" nor "{mod_name}" function') return func