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

qtconsole Out value prints before the print statements that precede it #780

Closed
jdmarch opened this issue Sep 11, 2011 · 1 comment
Closed
Milestone

Comments

@jdmarch
Copy link

jdmarch commented Sep 11, 2011

In [1]: def ff():
...: print '(computing)'
...: return 123

In [2]: ff()
Out[2]: 123(computing)

This does not occur in standard ipython.
Only tested on OSX.

minrk added a commit to minrk/ipython that referenced this issue Sep 12, 2011
This helps stream output arrive before pyout.

closes ipythongh-780
@minrk
Copy link
Member

minrk commented Sep 12, 2011

I see the same thing. I swear we keep fixing this, and it keeps coming back.

It's not necessarily incorrect that the 123 is coming before the printed message, because when print text actually gets drawn is controlled by sys.stdout.flush, so unless you are calling flush yourself, such things are not technically reliable (though they tend to be consistent within a given environment). What is definitely incorrect is that stdout content should never show up on the same line as pyout.

If we add sys.stdout.flush() to the zmq.displayhook prior to send, then it will behave as you are expecting, so we should probably do that (see PR #782).

@minrk minrk closed this as completed in a677855 Sep 12, 2011
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
This helps stream output arrive before pyout.

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

Successfully merging a pull request may close this issue.

2 participants