Re: Execute code after death of all child processes - (corrected posting)

2004-12-28 Thread Denis S. Otkidach
On Sat, 25 Dec 2004 08:20:24 -0600 Jeff Epler <[EMAIL PROTECTED]> wrote: > Next, you'll want to wait for each process you started: > for current_text in texts: > os.waitpid(-1, 0) > print 'this is the end' This can eventually die with exception. The proper way is: try:

Re: Execute code after death of all child processes - (corrected posting)

2004-12-25 Thread Jeff Epler
First, you'll want to exit from each forked copy, or else it will reach the code-after-the-for-loop: import sys, os, time texts = ['this is text1', 'this is text 2'] for current_text in texts[0:]: pid = os.fork() if pid == 0: time.sleep(2) print c

Re: Execute code after death of all child processes

2004-12-24 Thread Terry Reedy
"Markus Franz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I am a little puzzled about your variable declaration and use: > import sys, os, time > texts = ['this is text1', 'this is text 2'] You don't seem to use 'texts', > for current_text in env_sources[0:]: or define 'env_

Re: Execute code after death of all child processes

2004-12-24 Thread Mike Meyer
[EMAIL PROTECTED] (Markus Franz) writes: > Hallo! > > > I have a problem with this little script written in Python: > > > import sys, os, time > texts = ['this is text1', 'this is text 2'] > for current_text in env_sources[0:]: > pid = os.fork() > if pid == 0: > time.slee