[Tutor] cannot pickle instancemethod objects

Kent Johnson kent37 at tds.net
Tue Jun 12 12:20:11 CEST 2007


hok kakada wrote:
> Dear everyone,
> 
> I got a problem while pickling a class object. I have done something as below:
>         pickleFile = open(filename, 'wb')
>         pickle.dump(matcher, pickleFile)
>         pickleFile.close()
> 
> where matcher is  class object and I got the follow errors:
> TypeError: can't pickle instancemethod objects

What kind of object is matcher? Does it have any attributes that are 
functions? (Not methods you defined for the class, but functions or 
methods that you assign to attributes of self.)

Kent


More information about the Tutor mailing list