# Under Windows (tested XP-32): # # If this script is piped, e.g.: # # python stdout.py > somefile # or # python stdout.py | cat # # .. then any multiprocessing.Process children's stdout will not appear. Trying # to flush() stdout from the child process will produce an IOError. from multiprocessing import Process from sys import stdout, stderr def child(): print >> stderr, "[Child] stdout:", stdout print "[Child] message via stdout" stdout.flush() if __name__ == '__main__': print >> stderr, "[Parent] stdout:", stdout print "[Parent] message via stdout\n" stdout.flush() p = Process(target = child) p.start() p.join()