(I forgot to "reply-all" in my first response so Tobias will receive
this twice, sorry)
On 6/30/10 8:47 PM, Tobias Wendorff wrote:
Hi there,
I played around with multiprocessing module in Python, but
I've got some problems.
First, here are my two scripts:
1. http://paste.pocoo.org/show/229668/
2. http://paste.pocoo.org/show/229660/
The first script works like a charm, but the map gets defined
again in each loop ... that's not very good. So I tried to
put it in a class: each worker gets one map instance only.
But the second script doesn't work as expected:
"RuntimeError: basic_string::_S_construct NULL not valid"
Someone on #python gave me the hint that Mapnik creates
this error message.
Is my approach of multiprocessing wrong here?
Try instantiating the Map instance in the worker process instead of the
main parent process as mapnik objects cannot be safely pickled yet
(multiprocessing needs to be able to pickle objects to send them among
processes). That is, instead of doing it inside RenderThread.__init__ do
it inside RenderThread.loop before entering the while loop.
HTH,
Alberto
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users