Usually I can change stdout in Python by changing the value of sys.stdout. However, this only seems to affect print statements. So, is there any way I can suppress the output (to the console), of a program that is run via the os.system() command in Python?
Usually I can change stdout in Python by changing the value of sys.stdout .
Share
You could consider running the program via
subprocess.Popen, withsubprocess.PIPEcommunication, and then shove that output where ever you would like, but as is,os.systemjust runs the command, and nothing else.Much more flexible in my opinion. You might want to look at the full documentation: Python Subprocess module