readline() when there is no '/n'
Peter Abel
p-abel at t-online.de
Wed Feb 5 06:37:16 EST 2003
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')
but:
your proggy - if it's a python script and you will get
the filename by
filename=raw_input('Enter filename:')
-
will cause an EOFError: EOF when reading a line.
So it's not easy to understand the logic behind your
program to catch the ouput of an subprocess when this
is waiting for an input.
Regards
Peter
More information about the Python-list
mailing list