When I run IDLE (python 3.8) :
>>> import os
>>> os.system("ls")
0
>>> os.system('echo "test"')
0
>>> os.system("users")
0
>>>
But if i do :
os.system("ls > test.txt")
The test.txt file is created and contain the result.
I tried to reinstall and everything, nothing works... Only if I Run python in my terminal, command works but IDLE seems better for work.
Who could help me ? Thank you
os.system()
goes directly to your terminal; Python plays no part in the process. If you aren't running from a terminal, the output has nowhere to go. Use thesubprocess
module to run programs in a way that lets you do something with their output. – Grados