Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to print cell outputs when running sphinx-build in notebooks #434

Open
dmey opened this issue Apr 13, 2020 · 5 comments
Open

How to print cell outputs when running sphinx-build in notebooks #434

dmey opened this issue Apr 13, 2020 · 5 comments

Comments

@dmey
Copy link

dmey commented Apr 13, 2020

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.

@mgeier
Copy link
Member

mgeier commented Apr 15, 2020

I don't quite understand what you mean.

Can you please provide a minimal example?

@dmey
Copy link
Author

dmey commented Apr 15, 2020

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.

@mgeier
Copy link
Member

mgeier commented Apr 15, 2020

OK, I see.

There is currently no way to do that.

Can nbconvert --execute do that?

@dmey
Copy link
Author

dmey commented Apr 15, 2020

Can nbconvert --execute do that?

Running jupyter nbconvert --execute <notebook_name> does not print outputs. So I guess that this is probably related to jupyter/nbconvert#648.

@mgeier
Copy link
Member

mgeier commented Apr 15, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants