Piping processes works with 'shell = True' but not otherwise.
Peter Otten
__peter__ at web.de
Fri May 31 05:52:41 EDT 2013
Luca Cerone wrote:
>>
>> That's because stdin/stdout/stderr take file descriptors or file
>>
>> objects, not path strings.
>>
>
> Thanks Chris, how do I set the file descriptor to /dev/null then?
For example:
with open(os.devnull, "wb") as stderr:
p = subprocess.Popen(..., stderr=stderr)
...
In Python 3.3 and above:
p = subprocess.Popen(..., stderr=subprocess.DEVNULL)
More information about the Python-list
mailing list