Print does not appear below the expected cell after stream redirection
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
Hi,
When changing the print stream, and then setting it back to default in different cells, the string is printed under the cell where the stream redirection was done - 59 in the below screenshot. I expect the text to be printed below the cell where the print is written - 62 in the below screenshot.

Executing the upper-62 cell a second time effectively prints the text under this cell -cell 63 in the below screenshot.

This issue might seem benign, but I think that it might reveal a more profound issue in the handling of outputs in Jupyter notebooks.
Best,
Arnaud
Contributor guide
Research direction
The issue names no source file, test, or entry point. First reproduce the stream redirection across the cells shown in the screenshots, then trace how Jupyter Notebook associates redirected output with cells. Done means output appears below the cell containing the print call, including after the stream is restored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100