From 1e181b187a712e715717e1c24f11415c0ece6414 2012-06-13 21:31:24 From: MinRK Date: 2012-06-13 21:31:24 Subject: [PATCH] use notebook-dir as cwd for kernels --- diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index bc5dc9e..5207aa9 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -330,8 +330,9 @@ class MainKernelHandler(AuthenticatedHandler): @web.authenticated def post(self): km = self.application.kernel_manager + nbm = self.application.notebook_manager notebook_id = self.get_argument('notebook', default=None) - kernel_id = km.start_kernel(notebook_id) + kernel_id = km.start_kernel(notebook_id, cwd=nbm.notebook_dir) data = {'ws_url':self.ws_url,'kernel_id':kernel_id} self.set_header('Location', '/'+kernel_id) self.finish(jsonapi.dumps(data)) diff --git a/IPython/frontend/html/notebook/kernelmanager.py b/IPython/frontend/html/notebook/kernelmanager.py index 7029e83..6bd0687 100644 --- a/IPython/frontend/html/notebook/kernelmanager.py +++ b/IPython/frontend/html/notebook/kernelmanager.py @@ -245,7 +245,7 @@ class MappingKernelManager(MultiKernelManager): if notebook_id is not None: del self._notebook_mapping[notebook_id] - def start_kernel(self, notebook_id=None): + def start_kernel(self, notebook_id=None, **kwargs): """Start a kernel for a notebok an return its kernel_id. Parameters @@ -257,7 +257,6 @@ class MappingKernelManager(MultiKernelManager): """ kernel_id = self.kernel_for_notebook(notebook_id) if kernel_id is None: - kwargs = dict() kwargs['extra_arguments'] = self.kernel_argv kernel_id = super(MappingKernelManager, self).start_kernel(**kwargs) self.set_kernel_for_notebook(notebook_id, kernel_id) diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py index cc8b9f2..a256140 100644 --- a/IPython/frontend/html/notebook/notebookapp.py +++ b/IPython/frontend/html/notebook/notebookapp.py @@ -407,7 +407,6 @@ class NotebookApp(BaseIPythonApplication): def init_configurables(self): # force Session default to be secure default_secure(self.config) - # Create a KernelManager and start a kernel. self.kernel_manager = MappingKernelManager( config=self.config, log=self.log, kernel_argv=self.kernel_argv, connection_dir = self.profile_dir.security_dir,