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 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
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.