From e65389376d43fcde0af79fd46568806b7d6bc8b2 Mon Sep 17 00:00:00 2001 From: x12sa Date: Fri, 11 Sep 2026 07:46:23 +0200 Subject: [PATCH] fix(flomni): fix UnboundLocalError for dev in tomo_scan_projection dev = builtins.__dict__.get("dev") was only executed inside the `if not _internal:` block, but Python treats any name assigned anywhere in a function as local to the whole function. The unconditional dev.rtx.controller.laser_tracker_check_signalstrength() call later in the function then raised UnboundLocalError whenever _internal=True (e.g. tomo_alignment_scan() and the fermat branch of _at_each_angle). Hoist the fetch above the guard so dev is always bound. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_018CUx5yV1iCBhL5sFEHEoPe --- csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py index 36c22c3e..2e2c031c 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py @@ -3363,8 +3363,8 @@ class Flomni( _at_each_angle, and tomo_alignment_scan, which needs real ptycho data) pass _internal=True to skip the prompt. """ + dev = builtins.__dict__.get("dev") if not _internal: - dev = builtins.__dict__.get("dev") all_out, offending = filters_out_of_beam(dev) if not all_out: warning = f"Not all filters are out of the beam: {', '.join(offending)}."