I want to redirect both output and stderr to a log file. Easy enough, right?
python3 /home/user/Utilities/gpu.py L1.py &> log_L1.py.txt &
However, when instead of calling the command directly I use a system call, I do not get the output and the stderr in the files, but rather they are returned to my screen, and the output files are not created.
staggered_runner.py:
import time
import os
scripts=['L1.py','L2.py','L3.py','L4.py','L3_2D.py','L4_2D.py']
waiting=1200
for s in scripts:
command='python3 /home/user/Utilities/gpu.py '+s+' &> log_'+s+'.txt &'
print (command)
os.system (command)
time.sleep(waiting)
Then I run
python3 staggered_runner.py
I expected to receive only the direct outputs of staggered_runner.py
, that is, those of each run of print (command)
, and have the rest directed to the to appropriate files.
How can I do this, while still using the wrapper?