0

At the end of my notebook, I want to export an HTML version of it. So I use the jupyter nbconvert command line utility in a notebook cell:

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

where nb_path contains the path to the notebook file (.ipynb) and nfname is a name that ends in .html.

This works fine on a Mac, but fails in Windows 10. There I get as output:

"This application is used to convert..."

that is, the same output as if I run just jupyter nbconvert (without arguments) in a cmd prompt.

If I open a cmd prompt and manually type the above command (with the actual file names instead of the variable names), then everything executes just fine.

So it seems that the ! shortcut in jupyter notebook cell doesn't pass the arguments properly to the windows terminal. Is there a mechanism to do that, or do I have to resort to Popen?

1 Answer 1

1

Use double quotes:

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

works for me on Windows 10

Sign up to request clarification or add additional context in comments.

2 Comments

AAARRRGGHHHHH! I knew it was something simple. I did try enclosing the single quotes in double quotes and other variations, but did not try just double quotes. Thanks.
Glad it helped. Please accept the answer if you think it is correct. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.