jupyter / jupyter/notebook

Print does not appear below the expected cell after stream redirection

Open
#3,300 1 comment 0 reactions 0 assignees View on GitHub
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.
![jupyter_printstreamredirection](https://user-images.githubusercontent.com/31649530/35766569-302f4740-08db-11e8-99eb-b52b45812e90.png)

Executing the upper-62 cell a second time effectively prints the text under this cell -cell 63 in the below screenshot.
![jupyter_printstreamredirection_2](https://user-images.githubusercontent.com/31649530/35766575-49667f80-08db-11e8-9372-2d459bdd3649.png)

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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.