nbsphinx
nbsphinx copied to clipboard
How to print cell outputs when running sphinx-build in notebooks
I need to debug a notebook and looking for a way to print all output to console. I tried to increase verbosity in sphinx-build
but this did not help. Although the exception is captured and printed to console, nothing before/after (e.g. in a try-except-finally) is printed.
I don't quite understand what you mean.
Can you please provide a minimal example?
Assuming you have already set up a Sphinx project with nbsphinx
add a cell with print('hello')
, then run sphinx-build -v
... My expectation was to see hello
printed to stdout.
OK, I see.
There is currently no way to do that.
Can nbconvert --execute
do that?
Can nbconvert --execute do that?
Running jupyter nbconvert --execute <notebook_name>
does not print outputs. So I guess that this is probably related to https://github.com/jupyter/nbconvert/issues/648.
Yes, it looks like that has been requested for nbconvert
but there has been no solution yet, but there have been suggestions to use alternative notebook runners.
So once nbconvert
can do this, nbsphinx
should be able to implement it, too.
I'm also open to suggestions for using an alternative notebook runner, but I'm not planning on working on that myself.