![Python subprocess call hide output](https://kumkoniak.com/85.jpg)
![python subprocess call hide output python subprocess call hide output](https://appdividend.com/wp-content/uploads/2019/05/Python-Subprocess-Tutorial-With-Example-Subprocess-Module-in-Python.png)
You can use subprocess.PIPE to capture STDOUT and STDERR independently.If you simply want to capture both STDOUT and STDERR independently, AND you are on Python >= 3.7, use capture_output=True.Here is how to capture output (to use later or parse), in order of decreasing levels of cleanliness. Everything else would be identical to method #1.
![python subprocess call hide output python subprocess call hide output](https://i.stack.imgur.com/cM901.png)
If you want a fully manual method, can redirect to /dev/null by opening the file handle yourself.n(, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) # Alternatively, you can merge stderr and stdout streams and redirect n(, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) # this will also redirect stderr to /dev/null as well You can redirect to the special subprocess.DEVNULL target.Here is how to suppress output, in order of decreasing levels of cleanliness.
![Python subprocess call hide output](https://kumkoniak.com/85.jpg)