ipython-contrib / jupyter_contrib_nbextensions

A collection of various notebook extensions for Jupyter
http://jupyter-contrib-nbextensions.readthedocs.io/en/latest
Other
5.23k stars 806 forks source link

printview assumes the notebook is in the current working directory #1085

Open achampion opened 7 years ago

achampion commented 7 years ago

Printview fails if you have changed the working directory of your notebook, e.g.

%cd subdirectory

Now printview fails with:

[NbConvertApp] WARNING | pattern 'notebook.ipynb' matched no files

And just prints out the help message to nbconvert in the log.

juhasch commented 7 years ago

It is not so easy to get the path right, because the current implementation of printview starts an jupyter nbconvert command in the current kernel, and possibly (as you noticed in) the wrong directory. Fixing would be possible with some effort. I think the better solution is to wait for https://github.com/jupyter/notebook/pull/2413.

achampion commented 7 years ago

Agree, it would be better to have jupyter do the conversion vs the python kernel doing it. As you mentioned while it is easy to get the path of the notebook relative to the jupyter root, getting that jupyter root in the python kernel not so easy.

michalkahle commented 4 years ago

Printview also doesn't work with R kernel (or any other than Python kernel) for the reason mentioned above (tries to execute Python code in current kernel to convert the notebook).