Skip to content

Commit

Permalink
Catch exception raised by socket.gethostbyname() if the serial port n…
Browse files Browse the repository at this point in the history
…ame is too long.
  • Loading branch information
Stephen Irons committed May 18, 2022
1 parent 76ccf58 commit ed0fa07
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rshell/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ed0fa07

Please sign in to comment.