[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Surface and picklability, deepcopy



My latest project involved pulling all the frames out of a large number of
animated gif files and preparing them (using PIL) for display, the slowness
of which encouraged me to multiprocess the whole thing. But to my chagrin I
found that I couldn't communicate the resultant Surfaces between processes;
pipes and sockets require picklable objects and Queue I presume uses a
deepcopy somewhere as trying to blit the de-Queued Surfaces resulted in a
seg fault.

I eventually found a workaround (PIL data is communicated, and conversions
to pygame Surfaces happen in the main process), but I couldn't find an
explanation why Surfaces cannot be pickled or deepcopied, much less any way
to enable this functionality for them. I'd guess it has something to do with
it's SDL implementation?

Using python 2.7.3, pygame 1.9.1, pillow 2.3 in case there's something
peculiarity to any of them (or their combination) that I missed, but really
I'd just like to be enlightened about why these limitations to Surface
exist.



--
View this message in context: http://pygame-users.25799.x6.nabble.com/Surface-and-picklability-deepcopy-tp1063.html
Sent from the pygame-users mailing list archive at Nabble.com.