Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
jdmarch opened this Issue · 1 comment

2 participants

Jonathan March Min RK
Jonathan March
Collaborator

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.

Min RK minrk referenced this issue from a commit in minrk/ipython
Min RK minrk flush stdout/stderr on displayhook
This helps stream output arrive before pyout.

closes gh-780
b0f5b76
Min RK
Owner

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).

Min RK minrk closed this issue from a commit
Min RK minrk flush stdout/stderr on displayhook
This helps stream output arrive before pyout.

closes gh-780
a677855
Min RK minrk closed this in a677855
Fernando Perez fperez referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
matthew von rocketstein mattvonrocketstein referenced this issue from a commit in mattvonrocketstein/ipython
Min RK minrk flush stdout/stderr on displayhook
This helps stream output arrive before pyout.

closes gh-780
6900594
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.