![]() 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. 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.
0 Comments
Leave a Reply. |