Delays getting data on sys.stdin.readline() ?

Mike Meyer mwm at mired.org
Sat Nov 19 23:44:48 EST 2005


Christian Convey <christian.convey at gmail.com> writes:
> I've got a program that (ideally) perpetually monitors sys.stdin for
> lines of text. As soon as a line comes in, my program takes some
> action.
> The problem is, it seems like a very large amount of data must
> accumulate on sys.stdin before even my first invocation of readline()
> returns.  This delay prevents my program from being responsive in the
> way it must be.

readline normally returns as soon as it sees a newline. External
conditions may cause this to change, or make it impossible. Without
knowing those external conditions, the best we can do is guess as to
what might be the problem.

> Has anyone else seen this effect?  If so, is there a reasonable workaround?

Yes, and maybe. Depends on what's causing the problem. Tell us more
about the program, and what sys.stdin is connected to, and the
platform you're running on, and someone should be able to provide
explicit information.


     <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list