diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py index 0837129..86d48fd 100644 --- a/IPython/frontend/html/notebook/notebookapp.py +++ b/IPython/frontend/html/notebook/notebookapp.py @@ -40,6 +40,7 @@ from jinja2 import Environment, FileSystemLoader from zmq.eventloop import ioloop ioloop.install() +import tornado from tornado import httpserver from tornado import web @@ -524,7 +525,7 @@ class NotebookApp(BaseIPythonApplication): except socket.error as e: # XXX: remove the e.errno == -9 block when we require # tornado >= 3.0 - if e.errno == -9: + if e.errno == -9 and tornado.version_info[0] < 3: # The flags passed to socket.getaddrinfo from # tornado.netutils.bind_sockets can cause "gaierror: # [Errno -9] Address family for hostname not supported" @@ -533,7 +534,7 @@ class NotebookApp(BaseIPythonApplication): # not cause this error, but the only way to do this is to # monkeypatch socket to remove the AI_ADDRCONFIG attribute saved_AI_ADDRCONFIG = socket.AI_ADDRCONFIG - self.log.info('Monkeypatching socket to fix tornado bug') + self.log.warn('Monkeypatching socket to fix tornado bug') del(socket.AI_ADDRCONFIG) try: # retry the tornado call without AI_ADDRCONFIG flags