Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!panix!gordon From: John Gordon Newsgroups: comp.lang.python Subject: Re: Reducing cache/buffer for faster display Date: Thu, 27 Sep 2012 22:25:39 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 24 Message-ID: References: NNTP-Posting-Host: panix1.panix.com X-Trace: reader1.panix.com 1348784739 1772 166.84.1.1 (27 Sep 2012 22:25:39 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Thu, 27 Sep 2012 22:25:39 +0000 (UTC) User-Agent: nn/6.7.3 Xref: csiph.com comp.lang.python:30336 In Chris Angelico writes: > On Fri, Sep 28, 2012 at 7:57 AM, Rikishi42 wrote: > > I have these 2 scripts that are very heavy on the file i/o, consume a very > > reasonable amount of cpu and output their counters at a - very - relaxed > > pace to the console. The output is very simply done using something like: > > > > print "files:", nFiles, "\r", > > > > > > Yet alltough there is no real reason for it, even a pace of a print every > > 10-30 secs will be cached, only to actually show an output update every 1-2 > > min or so. > Yup! Just add a call to sys.stdout.flush() after each print. Isn't terminal output line-buffered? I don't understand why there would be an output delay. (Unless the "\r" is messing things up...) -- John Gordon A is for Amy, who fell down the stairs gordon@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies"