9

After launching the Jupyter Lab interface, I tried to open a Python file using the File -> Open menu. Yet no matter what I enter for a path in my PC, it cannot be reached. Does Jupyter Lab impose any restriction upon gaining access to a PC's directory? And how can I open files from any directory I desire if there is any workaround?

Here is a screenshot of the "Open" dialogue.

JupyterLab Open Path dialogue

Samuel Lelièvre
  • 3,212
  • 1
  • 14
  • 27
Theron
  • 567
  • 1
  • 7
  • 21

1 Answers1

7

The JupyterLab root is usually where JupyterLab was started from.

For example if we start JupyterLab as follows:

$ cd ~/year
$ jupyter lab

then the JupyterLab root is ~/year.

There is a command-line option to select a different directory. For example, if we do the following,

$ cd ~/season
$ jupyter lab --notebook-dir ~/year

then the JupyterLab root is again ~/year.

The relative path for a file ~/year/month/day.txt would then be month/day.txt --- so enter that in the "Open Path" dialogue and it should open.

I find the grey hint /path/relative/to/jlab/root in the "Path" field of the "Open File" dialogue misleading. In my opinion it should be path/relative/to/jlab/root without the initial slash.

Regarding restrictions, the restriction is that JupyterLab can only access files which are inside the root directory determined when starting it.

So in the example, we cannot access files outside ~/year.

Samuel Lelièvre
  • 3,212
  • 1
  • 14
  • 27