1

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

1

1 Answer 1

1

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()
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.