From ee3048d9857d26001d3d3e7821bfe1ce72036e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20M=C3=BCller?= Date: Fri, 27 May 2022 08:33:53 +0200 Subject: [PATCH] catch serial exception on device open - fixes #502 (#504) --- NanoVNASaver/Hardware/Hardware.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NanoVNASaver/Hardware/Hardware.py b/NanoVNASaver/Hardware/Hardware.py index 4e4047e..a609fa1 100644 --- a/NanoVNASaver/Hardware/Hardware.py +++ b/NanoVNASaver/Hardware/Hardware.py @@ -88,7 +88,11 @@ def get_interfaces() -> List[Interface]: t.name, d.vid, d.pid, d.device) iface = Interface('serial', t.name) iface.port = d.device - iface.open() + try: + iface.open() + except serial.SerialException: + logger.warning("Could not open serial port %s", d.device) + continue iface.comment = get_comment(iface) iface.close() interfaces.append(iface)