python equivalent of the following program

AndyL ask at me
Thu May 11 19:10:59 EDT 2006


Edward Elliott wrote:
> Steven Bethard wrote:
> 
>>import subprocess
>>
>>file1 = open('file1', 'w')
>>prog1 = subprocess.Popen(['prog1'], stdout=file1)
> 
> 
> And if the script runs somewhere that stderr is likely to disappear:
> 
> prog1 = subprocess.Popen(['prog1'], stdout=file1, stderr=subprocess.STDOUT)
> 

Forgot to mention before that the main motivation is to have the same 
code on bot Linux and M$ platforms.


Does subprocess work well on both?

Also how to find out that the 'prog1' e.g. has exited and it is  done?

Thx,
A.



More information about the Python-list mailing list