Skip to content

Commit 5487f7a

Browse files
authored
Merge pull request #735 from tache/master
Added descriptive FileNotFoundError handler for serial device connection
2 parents c6d8a54 + 8c115dc commit 5487f7a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

meshtastic/__main__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,19 @@ def common():
12451245
noProto=args.noproto,
12461246
noNodes=args.no_nodes,
12471247
)
1248+
except FileNotFoundError:
1249+
# Handle the case where the serial device is not found
1250+
message = (
1251+
f"File Not Found Error:\n"
1252+
)
1253+
message += f" The serial device at '{args.port}' was not found.\n"
1254+
message += " Please check the following:\n"
1255+
message += " 1. Is the device connected properly?\n"
1256+
message += " 2. Is the correct serial port specified?\n"
1257+
message += " 3. Are the necessary drivers installed?\n"
1258+
message += " 4. Are you using a **power-only USB cable**? A power-only cable cannot transmit data.\n"
1259+
message += " Ensure you are using a **data-capable USB cable**.\n"
1260+
meshtastic.util.our_exit(message, 1)
12481261
except PermissionError as ex:
12491262
username = os.getlogin()
12501263
message = "Permission Error:\n"

0 commit comments

Comments
 (0)