-
Notifications
You must be signed in to change notification settings - Fork 55
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
output of type stream
is split over multiple cells
#278
Comments
A user reported that this seems to be caused by calls to flushing the stream, and so a python kernel with this should suffice to repro: for i in range(1,6):
print("hello world", flush=True) |
Thanks for reporting the issue. |
Ah my bad, I think it's just a question of "grouping" the outputs per type, I don't think nbclient does that indeed. |
Right. FWIW, I've just implemented a very similar workaround on quarto: https://github.com/quarto-dev/quarto-cli/pull/5042/files#diff-f14392ed1b322ded009b3110fd5501edca659f5d0215c3491dfb26711e699083 |
No nbclient/nbconvert have never coalesced the streams: https://github.com/executablebooks/MyST-NB/blob/385c4a7afb3a377486c1aa7a86b4c8a0e93484f5/myst_nb/core/utils.py#L12 |
@chrisjsewell Thanks for the added info. I understand it does not, and we now have a workaround on our side. But I'm wondering whether it should (specifically so the resulting .ipynb with multiple outputs render correctly. This comes up not only in quarto, but in jupyter lab, jupyter notebook and visual studio as well). |
I opened #279 with @chrisjsewell's solution in MyST-NB. I just copy/pasted your code, please let me know if it's fine! |
oh yeh absolutely no problem, thanks for asking! |
Thanks, I added you as a co-author. |
Hi! Over at quarto, we're seeing execution behavior that doesn't match that of
jupyter lab
orjupyter notebook
for cells that produce streaming output. Specifically, the output is unpredictably split across multiple cells. This is a problem because multiple cells are expected to be in the output.Consider this repro (I apologize for requiring the julia kernel, this is the one open-source kernel we've been able to reproduce the issue with)
nbclient_test.py
test.ipynb
steps to repro
Note the output is broken across the files. For some kernels, the resulting output is mangled.
If this cell is executed in
jupyter notebook
orjupyter lab
, we see a single output instead:We were surprised by this behavior, and are wondering if this is expected output for you. Thank you!
The text was updated successfully, but these errors were encountered: