0

I'm writing a Python script to run several executables one by one on Windows. I need to wait a program to finish before starting the next.

So the script will be like this.

1: launch a.exe 2: wait till a.exe finishes running 3: launch b.exe 4: wait till b.exe finishes 

Anyone have an idea how to make the script waiting for a process to finish in Python?

Thanks

1
  • IMO You don't have to specially do anything, It just works the way you intend here. Commented Jun 8, 2016 at 4:41

1 Answer 1

3

If you wish to wait for your launched process, you can simply use subprocess.call() . This method executes the command in args and waits for it to complete. For reference, see this

import subprocess subprocess.call(('someprog.exe', str(i))) 
Sign up to request clarification or add additional context in comments.

1 Comment

If you want each one to complete, use subprocess.check_call to see if they were successful or not.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.