From d8afee8fec40ea3ad578da0e3f87eb8d3721afd5 2012-09-16 21:03:06 From: Ohad Ravid Date: 2012-09-16 21:03:06 Subject: [PATCH] Answer Issue #2366 If a file notebook is used, and a relative directory is given, make it absolute. --- diff --git a/IPython/frontend/html/notebook/nbmanager.py b/IPython/frontend/html/notebook/nbmanager.py index 07625d1..42de93c 100644 --- a/IPython/frontend/html/notebook/nbmanager.py +++ b/IPython/frontend/html/notebook/nbmanager.py @@ -42,6 +42,11 @@ class NotebookManager(LoggingConfigurable): """) def _notebook_dir_changed(self, name, old, new): """do a bit of validation of the notebook dir""" + if not os.path.isabs(new): + # If we receive a non-absolute path, make it absolute. + abs_new = os.path.abspath(new) + self.notebook_dir = abs_new + return if os.path.exists(new) and not os.path.isdir(new): raise TraitError("notebook dir %r is not a directory" % new) if not os.path.exists(new):