Executing jupyter nbconvert as shell command within notebook doesn't work anymore

1,754 views
Skip to first unread message

DG

unread,
Oct 30, 2017, 5:59:52 PM10/30/17
to Project Jupyter
Hello,
    I am not sure when this started (perhaps with Jupyter 5?), but I used to be able to save an HTML copy of my notebook using this:

!jupyter nbconvert '$nb_path' --output '$nfname'

where nb_path is the full path of the notebook (.ipynb file) and nfname is the full path of the HTML file, ending in .html

Like I said, this used to work with no problem, but now I get:

["[NbConvertApp] WARNING | pattern '$nb_path' matched no files",

However, nb_path surely exists:

os.path.exists(nb_path)

returns True.

And, if I enter the same command in terminal, it works just fine. 

Any ideas?

Thomas Kluyver

unread,
Oct 31, 2017, 9:59:05 AM10/31/17
to Project Jupyter
The $nb_path syntax doesn't get replaced inside single quotes. Looking at the code for it in IPython, this is deliberate, and has not changed in quite a while. You can use double quotes ("$nb_path"), or you can use the format-style syntax ('{nb_path').

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/da12e9aa-b3cd-46bf-b1d8-afc396994cf0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

DG

unread,
Nov 1, 2017, 12:45:59 PM11/1/17
to Project Jupyter
takowl, thank you. You are right. Replacing single quotes with double quotes made it work again. 

Coming from Python where single quotes and double quotes are equivalent, this is a bit disconcerting. 
Reply all
Reply to author
Forward
0 new messages