subprocess-how to suppress the stdout

Fredrik Lundh fredrik at pythonware.com
Thu Oct 26 17:24:08 CEST 2006


alf wrote:

>> /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 ...

alright, os.devnull is your friend:

  Popen(..., stdout=open(os.devnull, "w"), stderr=subprocess.STDOUT, ...)

</F>




More information about the Python-list mailing list