##// END OF EJS Templates
Start webbrowser in a thread. Prevents lockup with Chrome....
Fernando Perez -
Show More
@@ -16,14 +16,17 b' Authors:'
16 # Imports
16 # Imports
17 #-----------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
18
18
19 # stdlib
19 import errno
20 import errno
20 import logging
21 import logging
21 import os
22 import os
22 import signal
23 import signal
23 import socket
24 import socket
24 import sys
25 import sys
26 import threading
25 import webbrowser
27 import webbrowser
26
28
29 # Third party
27 import zmq
30 import zmq
28
31
29 # Install the pyzmq ioloop. This has to be done before anything else from
32 # Install the pyzmq ioloop. This has to be done before anything else from
@@ -35,6 +38,7 b' tornado.ioloop.IOLoop = ioloop.IOLoop'
35 from tornado import httpserver
38 from tornado import httpserver
36 from tornado import web
39 from tornado import web
37
40
41 # Our own libraries
38 from .kernelmanager import MappingKernelManager
42 from .kernelmanager import MappingKernelManager
39 from .handlers import (LoginHandler,
43 from .handlers import (LoginHandler,
40 ProjectDashboardHandler, NewHandler, NamedNotebookHandler,
44 ProjectDashboardHandler, NewHandler, NamedNotebookHandler,
@@ -301,7 +305,10 b' class NotebookApp(BaseIPythonApplication):'
301 self.port))
305 self.port))
302 if self.open_browser:
306 if self.open_browser:
303 ip = self.ip or '127.0.0.1'
307 ip = self.ip or '127.0.0.1'
304 webbrowser.open("%s://%s:%i" % (proto, ip, self.port), new=2)
308 b = lambda : webbrowser.open("%s://%s:%i" % (proto, ip, self.port),
309 new=2)
310 threading.Thread(target=b).start()
311
305 ioloop.IOLoop.instance().start()
312 ioloop.IOLoop.instance().start()
306
313
307 #-----------------------------------------------------------------------------
314 #-----------------------------------------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now