mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Answer Issue #2366
If a file notebook is used, and a relative directory is given, make it absolute.
This commit is contained in:
parent
a8ed452103
commit
c58e152f57
@ -42,6 +42,11 @@ class NotebookManager(LoggingConfigurable):
|
|||||||
""")
|
""")
|
||||||
def _notebook_dir_changed(self, name, old, new):
|
def _notebook_dir_changed(self, name, old, new):
|
||||||
"""do a bit of validation of the notebook dir"""
|
"""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):
|
if os.path.exists(new) and not os.path.isdir(new):
|
||||||
raise TraitError("notebook dir %r is not a directory" % new)
|
raise TraitError("notebook dir %r is not a directory" % new)
|
||||||
if not os.path.exists(new):
|
if not os.path.exists(new):
|
||||||
|
Loading…
Reference in New Issue
Block a user