Skip to content

Commit d033748

Browse files
committed
handle exception when getting hostname
1 parent ad2241c commit d033748

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/songexplorer

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,13 @@ print("SongExplorer version: "+version)
137137
allow_websockets=["localhost:"+port]
138138
ipaddr="noIPv4s"
139139

140-
thisip = socket.gethostbyname(socket.gethostname())
141-
allow_websockets.append(thisip+":"+port)
142-
ipaddr=thisip
140+
try:
141+
thisip = socket.gethostbyname(socket.gethostname())
142+
except:
143+
print('can not get host by name')
144+
else:
145+
allow_websockets.append(thisip+":"+port)
146+
ipaddr=thisip
143147

144148
thisip = socket.gethostname()
145149
allow_websockets.append(thisip+":"+port)

0 commit comments

Comments
 (0)