Hi all,I was trying to share a dictionary of dictionaries of arrays with Manager from multiprocessing. Without multiprocessing the code works perfectly, but with the current example the last print does not show the correct result.
Any hint? Thanks, Darío Suárez
#!/usr/local/bin/python2.7 import sys import warnings from multiprocessing import Pool, Value, Array, Manager N_PROCESSES = 8 def f(results, key): results[key]['d'][3].append(1) def main(): pool = Pool(processes=N_PROCESSES) manager = Manager() results = manager.dict() for key in ['k', 'kk']: results[key] = dict([(key2, [[] for i in range(4)]) for key2 in ['d', 'dd']]) res = [ pool.apply_async(f, key) for key in ['k'] ] map(lambda x: x.wait(), res) print results['k'] print results['k']['d'] print results['k']['d'][3] if __name__ == "__main__": main()
-- http://mail.python.org/mailman/listinfo/python-list