0

I am using "subprocess" to execute a .exe file from a Python script. I need to do this in a loop, ie start the .exe, run it for a minute, kill it, do it all over again.

I am using subprocess.check_call to execute it with arguments, but I don't know how to stop it.

Oscar_Mariani
  • 728
  • 3
  • 9
  • 22

1 Answers1

0

subprocess.check_call is used to check the returned value - use subprocess.Popen this returns a process ID, (pid), which can be used after your time limit with pid.terminate() to end the process, (kill it).

Steve Barnes
  • 27,618
  • 6
  • 63
  • 73