From e2fe359527a88cf649e9f05cd7ad8fc6f0c766aa Mon Sep 17 00:00:00 2001 From: dudash Date: Sat, 8 Feb 2025 14:51:53 -0500 Subject: [PATCH] catch unhandled OSError when serial port in use --- meshtastic/__main__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 8f2aaf9..16cbc0c 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1255,6 +1255,12 @@ def common(): message += " After running that command, log out and re-login for it to take effect.\n" message += f"Error was:{ex}" meshtastic.util.our_exit(message) + except OSError as ex: + message = f"OS Error:\n" + message += " The serial device couldn't be opened, it might be in use by another process.\n" + message += " Please close any applications or webpages that may be using the device and try again.\n" + message += f"\nOriginal error: {ex}" + meshtastic.util.our_exit(message) if client.devPath is None: try: client = meshtastic.tcp_interface.TCPInterface(