Pickle problem

Harvey Thomas hst at empolis.co.uk
Tue Sep 10 08:44:57 EDT 2002


Erik Price wrote:
> 
> 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
> 
No, I haven't forgotten the parentheses. I'd like to pickle the match method of the compiled regular expression.

Harvey

_____________________________________________________________________
This message has been checked for all known viruses by the MessageLabs Virus Scanning Service.




More information about the Python-list mailing list