popen2 question

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Mon Jun 26 03:08:13 CEST 2006

In article <3026518.PBSJIyfHH0 at teancum>,
 David Bear <david.bear at asu.edu> wrote:

>I'm using popen2 and getting an extra 1 at the end of my output. I didn't
>see where this was explained in the docs so I clearly don't understand the
>behavior. My code is simple.
>(input, output) = os.popen2('whackyperlprogram')
>results = output.read()
>rc = output.close()
>print results

What if, for comparison, you try running a trivial program that produces 
no output:

(input, output) = os.popen2('/bin/true')
results = output.read()
rc = output.close()
print results

Do you still get the "1" at the end?

More information about the Python-list mailing list