Hi! My class with implemented __getattr__ and __setattr__ methods cannot be pickled because of the Error:
====================================================================== ERROR: testPickle (__main__.TestDeffnet2WithBiases) ---------------------------------------------------------------------- Traceback (most recent call last): File "deffnet.py", line 246, in testPickle cPickle.dump(self.denet, file) TypeError: 'NoneType' object is not callable ---------------------------------------------------------------------- Is there an obvious reason i don't know, which prevents pickling with those methods (if i comment them out the pickling test passes)? I'm using Python 2.4.4 on Gentoo Linux. The mentioned methods goes as follows: def __setattr__(self, name, value): if name == 'weights': j = 0 for net in self.nets: w1 = self.wmarks[j] w2 = self.wmarks[j+1] net.weights = value[w1:w2] j += 1 else: self.__dict__[name] = value def __getattr__(self, name): if name == 'weights': j = 0 for net in self.nets: w1 = self.wmarks[j] w2 = self.wmarks[j+1] self._weights[w1:w2] = net.weights j += 1 return self._weights Greetings, -- Marek -- http://mail.python.org/mailman/listinfo/python-list