From 8c115dc6364b9dc5dfd4c888eafcecf723db86d8 Mon Sep 17 00:00:00 2001 From: tache Date: Sun, 9 Feb 2025 14:23:31 -0500 Subject: [PATCH] Added descriptive FileNotFoundError handler for serial device connection - Added a detailed error message for FileNotFoundError when the serial device is not found. - Included troubleshooting steps for common issues. --- meshtastic/__main__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 8f2aaf92..0d179a7d 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1245,6 +1245,19 @@ def common(): noProto=args.noproto, noNodes=args.no_nodes, ) + except FileNotFoundError: + # Handle the case where the serial device is not found + message = ( + f"File Not Found Error:\n" + ) + message += f" The serial device at '{args.port}' was not found.\n" + message += " Please check the following:\n" + message += " 1. Is the device connected properly?\n" + message += " 2. Is the correct serial port specified?\n" + message += " 3. Are the necessary drivers installed?\n" + message += " 4. Are you using a **power-only USB cable**? A power-only cable cannot transmit data.\n" + message += " Ensure you are using a **data-capable USB cable**.\n" + meshtastic.util.our_exit(message, 1) except PermissionError as ex: username = os.getlogin() message = "Permission Error:\n"