getting a process return value from popen()?

Greg Fortune gfortune_ewu at ispchannel.com
Tue Oct 24 03:51:48 EDT 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 
know...

Greg Fortune


jschmitt at vmlabs.com 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 Deja.com http://www.deja.com/
> Before you buy.





More information about the Python-list mailing list