0

I am trying to run notebook_torun.ipynb in test_notebook.ipynb within Jupyter Lab Domino from a different directory but have failed. The structure looks as such:

root -> mnt -> test_notebook.ipynb

and I want to run

root -> repos -> test-directory -> notebook_torun.ipynb.

My attempt looks as such:

%run ../repos/test-directory.notebook_torun.ipynb

However everytime the command seems to append .py on the end so the error is File ../repos/test-directory.notebook_torun.ipynb.py not found.

Is there anyway to stop this behaviour so that it knows it is a notebook? Thanks

geds133
  • 1,503
  • 5
  • 20
  • 52
  • About "Is there anyway to stop this behavior so that it knows it is a notebook?" : It's adding the `.py` in a last ditch effort to deal with your bad path. If you properly point at the notebook file it won't do that behavior. Is `test-directory.notebook_torun.ipynb` a typo? – Wayne Feb 20 '23 at 20:01

1 Answers1

0

Did you try the following inside test_notebook.ipynb?

%run ../repos/test-directory/notebook_torun.ipynb

Or if you want to use the absolute path, you can use this if root is the same as home (it may not be though, see here.):

%run ~/repos/test-directory/notebook_torun.ipynb

You should be able to test and develop all this using ls (or %cd and pwd, with %cd ~/mnt to switch back to original location of your test_notebook.ipynb,) inside your notebook.

Wayne
  • 6,607
  • 8
  • 36
  • 93