Skip to content

Commit

Permalink
Merge pull request #186 from ironss-iotec/long-port-name
Browse files Browse the repository at this point in the history
Catch exception raised by socket.gethostbyname() if the serial port name is too long
  • Loading branch information
dhylands authored May 18, 2022
2 parents 76ccf58 + ed0fa07 commit b87878c
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 b87878c

Please sign in to comment.