Re: TypeError: a class that defines __slots__ without defining __getstate__ cannot be pickled

Chema Cortes <[email protected]>
Newsgroups gmane.comp.python.general.castellano
Message-ID <[email protected]>
El 29 de agosto de 2009 15:31, Germán Aracil
Boned<[email protected]> escribió:

> He actualizado a python2.5 con lenny, y me he encontrado con que mis
> programas han dejado de funcionar. Sabe alguien como podría resolver esta
> nueva incompatibilidad ?
>
> He buscado por ahí, pero no he visto nada convincente que me ayude a
> resolver el problema. A alguien le ha pasado al actualizar de 2.4 a 2.5 ?
>
>
>
> [Sat Aug 29 15:18:10 2009] [error] [client 88.2.210.218] Premature end of
> script headers: /home/zoonsuite/webadmin/cgi-bin/pbx/index.py
> Traceback (most recent call last):
>
> (self.sid,self.user,",".join(self.groups),self.context,self.ext,self.accountcode,self.root,cPickle.dumps(self.sdata),cPickle.dumps(self.menus),self.crypt.gen_pass()))
>  File "/usr/lib/python2.5/copy_reg.py", line 76, in _reduce_ex
>   raise TypeError("a class that defines __slots__ without "
> TypeError: a class that defines __slots__ without defining __getstate__
> cannot be pickled
> [Sat Aug 29 15:20:57 2009] [error] [client 88.2.210.218] Premature end of
> script headers: /home/zoonsuite/webadmin/cgi-bin/pbx/index.py


Es difícil decirte algo que pueda ayudar. Faltaría ver más código, al
menos el que define la clase.

Desde luego el error está claro: "a class that defines __slots__
without defining __getstate__". Alguna clase define "slots", por lo
que cPickle no sabe muy bien cómo serializar el objeto (no es
suficiente con serializar el diccionario del objeto). Si no defines
ninguna clase que use slots, habría que estudiar qué otros objetos
estás serializando.
_______________________________________________
Lista de correo Python-es 
http://listas.aditel.org/listinfo/python-es
FAQ: http://listas.aditel.org/faqpyes
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.