From 67ffc3252f17771664345d2edba09608d27603c3 Mon Sep 17 00:00:00 2001 From: Shawn Date: Sat, 13 Jun 2026 21:05:21 -0400 Subject: [PATCH] Fix UnboundLocalError in MIDI handler when pyserial is missing - Remove serial.SerialException from except clause since 'serial' is not defined when import serial fails, causing UnboundLocalError - Catch only ImportError and OSError --- src/midi/handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/midi/handler.py b/src/midi/handler.py index a6e9117..06446c4 100644 --- a/src/midi/handler.py +++ b/src/midi/handler.py @@ -165,7 +165,7 @@ class UARTMIDI(MIDIInterface): ) logger.info("UART MIDI opened on %s", self._port_name) return True - except (ImportError, OSError, serial.SerialException) as e: + except (ImportError, OSError) as e: logger.error("UART MIDI open failed: %s", e) return False