console output of os.system()?
When calling os.system() in the Interactive Interpreter, you can see what it output's in the console. But in my case, I needed to change sys.stderr开发者_C百科 and sys.stdout to an instance of another class and the os.system function is called within an exec statement. The problem is, I don't see what it output's. It does not write to stderr nor to stdout. So my question: Where does the printed output of os.system() go to ?
Thanks, Niklas
It goes to either file descriptor 1 or 2, depending on whether it outputs to stdout or stderr. If you need finer control of the output then you should use subprocess
.
精彩评论