Skip to content

Fix: defer GUI imports in CLI and log BrainFlow session errors (#289) - #348

Open
ShakeelAhmed-NeuroAI wants to merge 2 commits into
NeuroTechX:masterfrom
ShakeelAhmed-NeuroAI:fix-issue-289
Open

ShakeelAhmed-NeuroAI wants to merge 2 commits into
NeuroTechX:masterfrom
ShakeelAhmed-NeuroAI:fix-issue-289

Conversation

@ShakeelAhmed-NeuroAI

Copy link
Copy Markdown

Closes #289

Summary

Addresses silent CLI exits and missing error diagnostics during interactive board selection (eegnb runexp -ip), particularly when initializing native Bluetooth BrainFlow devices (such as muse2_bfn) on Windows:

  1. Deferred GUI / PsychoPy imports in eegnb/cli/__main__.py: Moved check_report and pipelines imports out of module top-level into the functions that use them so PsychoPy/GUI subsystems do not initialize Windows COM in Single-Threaded Apartment (STA) mode before BrainFlow's SimpleBLE scans for BLE adapters. Also fixed a missing print() call on unrecognized signal-quality input.
  2. Diagnostic error logging & cleanup in eegnb/devices/eeg.py: Wrapped BoardShim.prepare_session() in _init_brainflow() to log a clear error message with device name, board ID, and BLE/serial troubleshooting hints on BrainFlowError, and cleanly release any partially prepared session before re-raising.
  3. Unit Tests (tests/test_cli_device_init.py): Added unit tests verifying lazy CLI imports and BrainFlowError logging/cleanup behavior.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

experiment does not start

1 participant