getting output from command that isn't STDIN

ldu02thc ldu02thc at rdg.ac.uk
Wed Feb 26 11:17:58 EST 2003


hullo,

I need to get the output from mencoder as it encodes videos. Most of it can
be retrieved easily enough, but after the initial blurb, it then displays a
progress meter with various information including percentage complete, and
that stays on the same line, if you get me, like wget's progress meter.

That line doesn't get picked up through STDTIN or STDERR... I only get the
last time that line is refreshed (when it's done) which isn't much use. How
can I grab this output?

The code atm is like this:
pipe = popen(command)
while 1:
        line = pipe.readline()
        if line == '':
                break
        print line


Thanks in advance for any help!

Tom






More information about the Python-list mailing list