subprocess.Popen(cmd) question

WolfgangZ wollez at gmx.net
Fri Aug 10 05:00:25 EDT 2007


Hello,

I'm starting some subprocesses inside a loop. The processes run 
independent and dont need any communication between each other. Due to 
memory issues I need to limit the number of running processes to around 
10. How can I insert a break into my loop to wait until some processes 
are finished?

Some minimal examplecode:

import subprocess
for i in range(0,100):
     cmd='ping localhost'
     p=subprocess.Popen(cmd)
     p.wait()

Thanks for any ideas.

Wolfgang




More information about the Python-list mailing list