[Twisted-Python] help with InsecureJelly for unkown objects in classes

Ben Olsen bolsen at verio.net
Wed Mar 16 16:52:09 MST 2005


I know there are at least a few game programmers on this list, so I'm 
hoping someone can help me out. I figured a simple NetPong game would be 
a great way to learn some Twisted and Pygame, and so far it's gone well. 
I was able to run a simple game by sending individual game status 
elements between client and server. Just today I tried to change things 
around to use pb.Copyable and pb.RemoteCopy to send a GameStatus class 
which contains all the game state details (player positions, ball 
position, etc). I've managed to send the class, but only if it contains 
standard objects. However, I'd like the GameStatus to include a really 
useful Pygame object, called Rect. Whenever I try to send that across 
the wire, I get:
twisted.spread.jelly.InsecureJelly: Type not allowed for object: <type 
'Rect'> <rect(0, 0, 32, 32)>

I've tried a number of things, but I can't get Twisted to accept a Rect 
as a sendable object. One thing I tried was subclassing Rect:
class netRect(Rect, pb.Copyable, pb.RemoteCopy):
   pass
and using that in my GameState instead. Still get the same error. I 
tried calling pb.setUnjellyableForClass for it on both client and server 
side (only client is receiving, but the exception is thrown on server 
side), but it didn't help. I also tried inheriting from Jellyable and 
Unjellyable, but I don't really understand the specifics of how to use 
those.

Does anybody have tips on passing custom objects (such as pygame.Rect) 
in Copyable classes?

Ben Olsen





More information about the Twisted-Python mailing list