multiprocessing and dictionaries

Bjorn Meyer bjorn.m.meyer at gmail.com
Sun Jul 12 19:16:13 CEST 2009


I am trying to convert a piece of code that I am using the thread module with 
to the multiprocessing module.

The way that I have it set up is a chunk of code reads a text file and assigns 
a dictionary key multiple values from the text file. I am using locks to write 
the values to the dictionary.
The way that the values are written is as follows:
	mydict.setdefault(key, []).append(value)

The problem that I have run into is that using multiprocessing, the key gets 
set, but the values don't get appended.
I've even tried the Manager().dict() option, but it doesn't seem to work.

Is this not supported at this time or am I missing something?

Thanks in advance.

Bjorn



More information about the Python-list mailing list