Open nthiery opened 2 years ago
Oh, and since I would use the ability to open a relative path in the deployment of my courses for my 200 students class starting next Tuesday, I am eager to beta-test anything, or any suggestion of workaround :-)
Thanks @nthiery for reporting.
So it looks like the docmanager:open
commands indeed takes a path relative to the JupyterLab root.
But since the kernel is decoupled and has access to the whole file system it could indeed be tricky to do this. Unless there is a way to retrieve the path of the JupyterLab root from the Python kernel, and then compute the relative path to the file before using the docmanager:open
command from Python.
Thanks for the feedback!
Would it be complicated to extend the docmanager:open command in JupyterLab to also support relative paths? E.g. with some option "relative=True"?
Of course, from a user perspective it would be better to follow the standard convention: a path is absolute if it starts with '/'; but I can see that, depending on the history, this could be a problem for backward compatibility to change it at this stage.
The docmanager:open command, at least when called from ipylab, seems to interpret paths as absolute from the lab root.
Option 1: this is a feature (possibly consistent with other pieces of JupyterLab); documentation mentionning the fact and suggesting how to open files referred to by a relative path from the current notebook would be helpful.
Option 2: it's a bug :-)
Thanks in advance!