From 2c6ca49d2e1bc1bcbb4263d8e1821df6ccb2a2e3 2013-03-18 20:53:40 From: Paul Ivanov Date: 2013-03-18 20:53:40 Subject: [PATCH] on resume, print server info again This commit makes it possible to differentiate between many different long-running notebook servers, where the original ip address and port information printed at the beginning has scrolled out of the screen. We save the server location string that gets printed on startup, and re-print it when the user attempts to interrupt the server with Ctrl-C Thanks to @minrk for discussion on how this should work. Also added a docstring to the start() method --- diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py index f8708ac..9ff3abb 100644 --- a/IPython/frontend/html/notebook/notebookapp.py +++ b/IPython/frontend/html/notebook/notebookapp.py @@ -576,7 +576,7 @@ class NotebookApp(BaseIPythonApplication): """ # FIXME: remove this delay when pyzmq dependency is >= 2.1.11 time.sleep(0.1) - sys.stdout.write("Shutdown Notebook Server (y/[n])? ") + sys.stdout.write("Shutdown Notebook Server at %s (y/[n])? " % self._url) sys.stdout.flush() r,w,x = select.select([sys.stdin], [], [], 5) if r: @@ -616,11 +616,16 @@ class NotebookApp(BaseIPythonApplication): self.kernel_manager.shutdown_all() def start(self): + """ Start the IPython Notebok server app, after initialization + + This method takes no arguments so all configuration and initialization + must be done prior to calling this method.""" ip = self.ip if self.ip else '[all ip addresses on your system]' proto = 'https' if self.certfile else 'http' info = self.log.info - info("The IPython Notebook is running at: %s://%s:%i%s" % - (proto, ip, self.port,self.base_project_url) ) + self._url = "%s://%s:%i%s" % (proto, ip, self.port, + self.base_project_url) + info("The IPython Notebook is running at: %s" % self._url) info("Use Control-C to stop this server and shut down all kernels.") if self.open_browser or self.file_to_run: