I am trying to pass file object to different processes using Manager().dict
, but I found the Manager().dict
will close file automatically. I wonder what is happened and how to keep file open.
import multiprocessing as mp
fileHandler = open('test.csv', 'r')
d = mp.Manager().dict()
d['a'] = fileHandler
print d
print d['a'].closed
output:
{'a': <closed file '<uninitialized file>', mode '<uninitialized file>' at 0x7f474f45f540>}
True