diff --git a/IPython/html/notebookapp.py b/IPython/html/notebookapp.py index 3303b86f0..cbeef79a7 100644 --- a/IPython/html/notebookapp.py +++ b/IPython/html/notebookapp.py @@ -530,6 +530,10 @@ class NotebookApp(BaseIPythonApplication): except: raise TraitError("Couldn't create notebook dir %r" % new) + # setting App.notebook_dir implies setting notebook and kernel dirs as well + self.config.FileNotebookManager.notebook_dir = new + self.config.MappingKernelManager.root_dir = new + def parse_command_line(self, argv=None): super(NotebookApp, self).parse_command_line(argv) diff --git a/IPython/html/services/kernels/kernelmanager.py b/IPython/html/services/kernels/kernelmanager.py index ac0063754..a2fb8ff33 100644 --- a/IPython/html/services/kernels/kernelmanager.py +++ b/IPython/html/services/kernels/kernelmanager.py @@ -42,18 +42,6 @@ class MappingKernelManager(MultiKernelManager): kernel_argv = List(Unicode) root_dir = Unicode(getcwd(), config=True) - def _root_dir_default(self): - from IPython.html.notebookapp import NotebookApp - if NotebookApp.initialized(): - try: - app = NotebookApp.instance() - except Exception: - # can raise MultipleInstanceError, ignore - pass - else: - return app.notebook_dir - return app.notebook_dir - return getcwd() def _root_dir_changed(self, name, old, new): """Do a bit of validation of the root dir.""" diff --git a/IPython/html/services/notebooks/filenbmanager.py b/IPython/html/services/notebooks/filenbmanager.py index c3bd19f44..8d4d68af5 100644 --- a/IPython/html/services/notebooks/filenbmanager.py +++ b/IPython/html/services/notebooks/filenbmanager.py @@ -47,17 +47,6 @@ class FileNotebookManager(NotebookManager): """ ) notebook_dir = Unicode(getcwd(), config=True) - def _notebook_dir_default(self): - from IPython.html.notebookapp import NotebookApp - if NotebookApp.initialized(): - try: - app = NotebookApp.instance() - except Exception: - # can raise MultipleInstanceError, ignore - pass - else: - return app.notebook_dir - return getcwd() def _notebook_dir_changed(self, name, old, new): """Do a bit of validation of the notebook dir."""