Orko
Orko

Reputation: 142

Jupyter on Mac: run files from non-default directory

I run Jupyter Notebook on a mac and I am trying to edit a notebook file from a git repo I am contributing to. However I am having trouble accessing the file from the Notebook interface.

Is there a way to access notebooks which are not in the default path on mac (navigation to arbitrary file locations works fine on windows) without changing the default directory to my git repo and without copying the file to my default directory and back every time I edit it?

It looks like direct navigation outside the path is impossible (Based on this post) but it seems that it should be possible to start the notebook from the given directory using the command line.

Things I've tried:

  1. Directly typing the relative and absolute path into the web interface with respect to the tree (i.e. http://localhost:8889/tree/../../[path-to-file]
  2. Renaming the file with the path as a prefix
  3. Starting jupyter from the directory containing the notebook

... with no success as of yet.

Any help on this would be greatly appreciated.

Upvotes: 1

Views: 925

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191874

it seems that it should be possible to start the notebook from the given directory using the command line

You can...

jupyter notebook /some/non-default/path

However, you can only reach sub-directories of that path with Jupyter

Starting jupyter from the directory containing the notebook

That should also work

If you python code needs to read files that are in parent directories, relative paths still resolve fine within the notebook kernel.

Upvotes: 2

Related Questions