Pickle problem

Erik Price erikprice at mac.com
Tue Sep 10 08:41:45 EDT 2002

On Tuesday, September 10, 2002, at 06:13  AM, Harvey Thomas wrote:

> I'm trying to pickle a complicated data structure which includes a 
> dictionary whose entries are created by (simplified):
> a[x] = re.compile(y).match
> The pickle fails, however, with the error:
> PicklingError: Can't pickle <built-in method match of _sre.SRE_Pattern 
> object at
>  0x00838700>: it's not found as __main__.match
> I'd be grateful if someone could tell me if it is possible to pickle 
> the data structure and what I'm doing wrongly.

Are you trying to store the MatchObject returned by a call to a regular 
expression object's match() method?  If so, it looks like you're 
forgetting the parens at the end of "re.compile(y).match".


Erik Price                                                  (zombies 

email: erikprice at mac.com
jabber: erikprice at jabber.org

More information about the Python-list mailing list