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:
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
"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_
[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