getting a process return value from popen()?

Greg Fortune gfortune_ewu at
Tue Oct 24 09:51:48 CEST 2000

Tack a .read() on the end

result = os.popen('foo.exe').read()

At least, that works great in 1.5.2.  If it doesn't in 2.0, I'd like to 

Greg Fortune

jschmitt at wrote:

> If you do something like:
> (instream,outstream) = popen4( "foo.exe" )
> how do you get the return value from 'foo.exe' when it finally
> terminates after reading everything from 'outstream'?  Say for
> example, 'foo.exe' returns a non-zero integer to indicate an error
> condition.
> John
> Sent via
> Before you buy.

More information about the Python-list mailing list