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
This commit is contained in:
2026-06-13 21:05:21 -04:00
parent 2aefa5303d
commit 67ffc3252f
+1 -1
View File
@@ -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