There is also a multiprocessing fork called multiprocess , which replaces pickle with dill . dill can distinguish file descriptors, and thus multiprocess can easily transfer them between processes.
>>> f = open('test.txt', 'w') >>> _ = map(f.write, 'hello world') >>> f.close() >>> import multiprocess as mp >>> p = mp.Pool() >>> f = open('test.txt', 'r') >>> p.apply(lambda x:x, f) 'hello world' >>> f.read() 'hello world' >>> f.close()
source share