Python 没有属性错误

Python 没有属性错误,python,serialization,Python,Serialization,我正在尝试通过网络发送序列化对象,直到今天,这一切都很好 现在我有一个错误: @staticmethod def processkeys(self): ''' This method has to be static as it is used as a tarked for a Thread. All it does by now is receive a mouseAndKeyWrapperobject from the clie

我正在尝试通过网络发送序列化对象,直到今天,这一切都很好

现在我有一个错误:

@staticmethod                   
def processkeys(self):
    '''
    This method has to be static as it is used as a tarked for a Thread.
    All it does by now is receive a mouseAndKeyWrapperobject from the client and 
    set this instances object to it.
    '''
    logging.getLogger(__name__).warning("keys processed")
    print("here")
    sock = self.sock
    Id = self.id
    from modules.logic import game
    self.myPlayer  = game.get_player()
    while True:
        try:
            myMakw = sock.recv(4096)
            self.makw = loads(myMakw)
            self.movePlayers(self.makw)
        except:
            logging.getLogger("nothing from Client")

        self.wrap.addPlayer(self.myPlayer)
        wrapToSend = dumps(self.wrap, 2)

        sock.sendall(wrapToSend)
工作正常,直到最后一行之前: 转储将产生以下错误消息:

    wrapToSend = dumps(self.wrap, 2)
AttributeError: 'module' object has no attribute 'py_decode_TypedWritable_from_bam_stream'
我以前用这个方法序列化和反序列化过对象,甚至是自写的对象,但从未得到过类似的结果。 就连谷歌似乎也不知道那个特定的错误信息(零点击)


有人知道哪里出了问题吗?

当使用
classmethod
staticmethod
装饰器时,不应该有
self
参数。现在的问题是在什么上下文中调用它,以及这个
self
实际上指的是什么——毕竟,Python并没有对名为
self
的参数强制任何特定的含义。我有一种感觉,你也在混淆类属性和实例属性,这就是为什么这之前没有失败,但如果没有一些实际的示例代码,这很难判断。

听起来像是
wrap
不是你想象的那样。试着打印(self.wrap)看看你得到了什么。只要我不尝试将玩家添加到列表中,它就可以正常工作,因此我猜玩家是不可序列化的。