warn about failure to bind to localhost

when falling back on 127.0.0.1
This commit is contained in:
Min RK 2015-03-01 20:21:43 -08:00
parent c605ea44cc
commit f76ce1d6b9

View File

@ -418,7 +418,8 @@ class NotebookApp(BaseIPythonApplication):
s = socket.socket()
try:
s.bind(('localhost', 0))
except socket.error:
except socket.error as e:
self.log.warn("Cannot bind to localhost, using 127.0.0.1 as default ip\n%s", e)
return '127.0.0.1'
else:
s.close()