multiprocessing and dictionaries

Piet van Oostrum piet at cs.uu.nl
Mon Jul 13 03:56:08 EDT 2009


>>>>> Bjorn Meyer <bjorn.m.meyer at gmail.com> (BM) wrote:

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

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

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

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

I think you should give more information. Try to make a *minimal* program
that shows the problem and include it in your posting or supply a
download link.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list