[Python-bugs-list] [ python-Bugs-511992 ] IDE: sys.stdout.flush() doesn't work

noreply@sourceforge.net noreply@sourceforge.net
Mon, 04 Feb 2002 04:46:34 -0800


Bugs item #511992, was opened at 2002-02-01 16:54
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=511992&group_id=5470

Category: Macintosh
Group: Platform-specific
>Status: Closed
Resolution: None
Priority: 5
Submitted By: Jurjen N.E. Bos (jneb)
Assigned to: Just van Rossum (jvr)
Summary: IDE: sys.stdout.flush() doesn't work

Initial Comment:
Using: Mac OS X 10.1.1, Python 2.2 for Carbon.
Problem:

def t(n):
   for i in range(10):
     for j in range(n): pass
     sys.stdout.write(`i`)
     sys.stdout.write("\n")
     sys.stdout.flush()
t(100000) #depends on your system's performance

If you run this in an IDE window, you would expect that the digits appear with regular intervals. In fact, they appear all together.

This is quite irritating, since it frustrates "real time" output.

Jack asked me to assign it to Just.

Jurjen

----------------------------------------------------------------------

>Comment By: Just van Rossum (jvr)
Date: 2002-02-04 04:46

Message:
Logged In: YES 
user_id=92689

The problem was that the window's pixel buffer
wasn't explicitly flushed. This happens automatically
when you run an event loop, but you need to do it
by hand if you want to see the results before handing
control back to the event loop.
Fixed in CVS, both for the output window as the
interactive console.

----------------------------------------------------------------------

Comment By: Jack Jansen (jackjansen)
Date: 2002-02-04 02:02

Message:
Logged In: YES 
user_id=45365

Assigning to Just, this is his baby.

My guess is that flush() in the text widget class needs a bit more extra magic so that Waste actually updates the text widget in stead of waiting for the next update event. But that's pure guesswork:-)

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=511992&group_id=5470