I'm using python subprocess library to run command line in python file. After importing the library, I used following code to store the output
call(["python", "make.py", ">", "data"])
But for some reason, I didn't get data file
I'm using python subprocess library to run command line in python file. After importing the library, I used following code to store the output
call(["python", "make.py", ">", "data"])
But for some reason, I didn't get data file
You have to modify the stdout
, check the official document subprocess
import subprocess
my_output_file = open("/home/user/output", "a")
subprocess.call(["python", "hello.py"],stdout=my_output_file)
my_output_file.close()