subprocess-how to suppress the stdout

alf ask at me
Thu Oct 26 07:41:43 EDT 2006


Fredrik Lundh wrote:
> "alf" <ask at me.xs4all.nl> wrote:
> 
> 
>>I can achieve it by using Popen(...,stdout=subprocess.PIPE,...) but
>>wonder where the all stdout actually goes. Is it buffered (to eventually
>>fill up)
> 
> 
> it ends up in a pipe buffer, yes.
> 
> 
>>Or there is a better solution ...
> 
> 
> /dev/null is your friend:
> 
>     Popen(..., stdout=open("/dev/null", "w"), stderr=subprocess.STDOUT, ...)
> 

I am forced to use win32 :-( plus it needs to be platform independent ...



More information about the Python-list mailing list