[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] Pickling?



Hi,

I am trying to save a game. Is pickling Sprites supposed to work?
When running my game with python -i and checking stuff afterwards,
I get:

>>> sprite.__dict__
{'image': <Surface(40x40x16 SW)>, 'rect': <rect(1042, 931, 40, 40)>, '_Sprite__g': {<Group(111 sprites)>: 0, <RenderUpdates(152 sprites)>: 0}}
>>> sprite.__reduce__
<built-in method __reduce__ of Lolly object at 0x401d9b2c>
>>> cPickle.dumps(sprite)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
cPickle.UnpickleableError: Cannot pickle <type 'Surface'> objects

sprites *seem* to have a __dict__ and __reduce__, which *should* be
enough to pickle it, or shouldn't it?

yours,
Gerrit.

-- 
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org