我试图将一些数据写入缓存,其中一些数据已经使用psycopg2和sqlalchemy从postgres数据库中检索到。其中一些是NumericRange
实例。不幸的是,当我试图在将对象写入Redis缓存之前对其进行pickle时,它们引发了一个异常。在
lib/python2.7/copy_reg.py", line 77, in _reduce_ex
raise TypeError("a class that defines __slots__ without "
TypeError: a class that defines __slots__ without defining __getstate__ cannot be pickled
是否可以更改pickle,以便它可以处理NumericRange
对象?注意cpickle
用于序列化。在
目前没有回答
相关问题 更多 >
编程相关推荐