Is there a quiet version of subprocess.call?

fergusdawson picture fergusdawson · Dec 16, 2011 · Viewed 34.8k times · Source

Is there a variant of subprocess.call that can run the command without printing to standard out, or a way to block out it's standard out messages?

Answer

Matt Joiner picture Matt Joiner · Dec 16, 2011

Yes. Redirect its stdout to /dev/null.

process = subprocess.call(["my", "command"], stdout=open(os.devnull, 'wb'))