readline() when there is no '/n'
Andrew Bennetts
andrew-pythonlist at puzzling.org
Wed Feb 5 06:58:43 EST 2003
On Wed, Feb 05, 2003 at 03:37:16AM -0800, Peter Abel wrote:
> John Smith <someone at microsoft.com> wrote in message news:<4P_%9.77$1q2.11539 at newsread2.prod.itd.earthlink.net>...
> > I am running a process using popen2 and capturing the process output with
> > readline(). The program prompts for a file name "Enter filename:", and the
> > line doesn't end with a '/n' so the readline() method hangs up. Any
> > suggestions?
> >
> > John Smith
>
> try:
> lines=os.popen('proggy').read().split('\n')
Presumably if .readline() is blocking waiting for a \n or EOF, then .read()
will also block...
-Andrew.
More information about the Python-list
mailing list