flush stdout/stderr at the end of kernel init #1023

merged 3 commits into from Nov 24, 2011


None yet
2 participants

minrk commented Nov 21, 2011

call stdout/stderr.flush() to prevent print statements, etc. made during initialization from being associated with the first execution.

It turns out that the qtconsole actually depended on this behavior, so a small change was made there, which associates any messages having no parent as being meant for all frontends. The only messages for which this would normally be true are print statements made during initialization.

This draws an essential difference between the qt frontend and the notebook - in Qt, like the terminal, print statements during init do arrive in the console, below the banner. In the notebook, they are ignored.

closes #1022

minrk added some commits Nov 21, 2011

flush messages printed during startup
Prevents print statements during init methods from being associated with the first execution.

closes #1022
associate messages with no parent to all qt frontends
The only messages that should have no parent are print statements made prior to the first execution.  The principal example of this is the pylab welcome message.
explicitly ignore iopub messages not associated with a cell in the no…

An error would previously be raised whenever iopub traffic arrived that
did not originate with the notebook (e.g. pylab welcome, or qtconsole output).

This error was not in a block that would actually cause problems, so actual
functionality was not affected.

takluyver commented Nov 21, 2011

In the longer term, it might make sense to have an area above the first cell in the notebook where those messages are displayed. But I think that can wait.


minrk commented Nov 21, 2011

@takluyver - yes, though I imagine that very few people would want banners or startup messages at the top of their notebooks. If anything, I would actually be more inclined for the qtconsole to be like the notebook and omit these messages, but that would be a more significant change. #924 already expresses an interest in avoiding this kind of message when embedding the qtconsole.


takluyver commented Nov 21, 2011

It seems to be working OK (i.e. pylab banner in the Qt console, not in the notebook).

@takluyver takluyver merged commit dd634c9 into ipython:master Nov 24, 2011


takluyver commented Nov 24, 2011

Thanks, Min. I've merged this.

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