Child processes created with python multiprocessing module won’t print

Try this:

from multiprocessing import Process
import sys

def f(name):
    print 'hello', name
    sys.stdout.flush()

...

AFAIK the standard output of processed spawned by the multiprocessing module is buffered, hence you will see the output only if the buffer becomes full or you explicitly flush sys.stdout.

Leave a Comment