From ed0fa07f4822ad7b6396f8135a237e8b88b3eb6a Mon Sep 17 00:00:00 2001 From: Stephen Irons Date: Wed, 18 May 2022 15:21:04 +1200 Subject: [PATCH] Catch exception raised by socket.gethostbyname() if the serial port name is too long. --- rshell/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rshell/main.py b/rshell/main.py index c1980ef..7a810d9 100755 --- a/rshell/main.py +++ b/rshell/main.py @@ -1390,7 +1390,7 @@ def connect(port, baud=115200, user='micro', password='python', wait=0): ip_address = socket.gethostbyname(port) #print('Connecting to ip', ip_address) connect_telnet(port, ip_address, user=user, password=password) - except socket.gaierror: + except (socket.gaierror, ValueError): # Doesn't look like a hostname or IP-address, assume its a serial port #print('connecting to serial', port) connect_serial(port, baud=baud, wait=wait)