0

This post explains how to launch a single external program from Python How shall I launch multipal programs(or threads) at the same time ?

My intended application is a video slide show. I want to launch a image sequence player and a music player at the same time

Thanks in advance

asked Jul 10, 2011 at 3:43
4
  • Did you try calling it more than once? Commented Jul 10, 2011 at 3:48
  • @Ignacio Vazquez-Abrams: subprocess.call blocks until the subprocess completes. Commented Jul 10, 2011 at 3:51
  • subprocess.popen doesn't & is what I've used in the past to launch multiple proceses. Commented Jul 10, 2011 at 3:57
  • @user488551: you mean subprocess.Popen. Commented Jul 10, 2011 at 3:59

1 Answer 1

5

subprocess.Popen doesn't block unless you explicitly ask it to by calling communicate on the returned object, so you can call it more than once to start more than one process.

If you do need to communicate with both sub-processes simultaneously (read their STDOUT, for instance), then invoke subprocess.Popen in separate threads. Each thread can manage a sub-process and communicate with it. Naturally, this leaves you to do all the synchronization but that highly depends on your specific application.

answered Jul 10, 2011 at 4:11
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.