diff --git a/jupyter_server/services/kernels/kernelmanager.py b/jupyter_server/services/kernels/kernelmanager.py index e280959be3..1f57d1ee77 100644 --- a/jupyter_server/services/kernels/kernelmanager.py +++ b/jupyter_server/services/kernels/kernelmanager.py @@ -180,7 +180,7 @@ def _handle_kernel_died(self, kernel_id): self.log.warning("Kernel %s died, removing from map.", kernel_id) self.remove_kernel(kernel_id) - def cwd_for_path(self, path): + def cwd_for_path(self, path, **kwargs): """Turn API path into absolute OS path.""" os_path = to_os_path(path, self.root_dir) # in the case of documents and kernels not being on the same filesystem, @@ -212,7 +212,7 @@ async def _async_start_kernel(self, kernel_id=None, path=None, **kwargs): """ if kernel_id is None or kernel_id not in self: if path is not None: - kwargs["cwd"] = self.cwd_for_path(path) + kwargs["cwd"] = self.cwd_for_path(path, env=kwargs.get("env", {})) if kernel_id is not None: kwargs["kernel_id"] = kernel_id kernel_id = await self.pinned_superclass._async_start_kernel(self, **kwargs)