popen2 question

David Bear david.bear at asu.edu
Wed Jun 21 20:34:46 EDT 2006


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

The documentation said that the return code would returned with the stdout
handled was closed.

This does not explain why I am getting a '1' appended to the end of the
results.

And yes, there is some functionality bundled in a perl program that I need
-- and I don't have time to reimplement what was written in perl. When I
run the perl code directly, I get the output I want. When I run it through
the os.popen2 module, I get an additional 1 appended. (It's all string
output)

Is this normal behavior for this module? What am I missing?
-- 
David Bear
-- let me buy your intellectual property, I want to own your thoughts --



More information about the Python-list mailing list