[Tutor] Here is the whole script I'm having issues with.

alan.gauld@bt.com alan.gauld@bt.com
Thu, 22 Aug 2002 14:02:11 +0100


     
> class TextExtractor:
>      def __init__(self, html, t):
		...
>      def crop(self):
>      story = "(?sx)%s.+%s" % ("<!--Storytext-->", "<!--/Storytext-->")
>         newhtml = re.findall(story, self.html)

> Any weird indenting is due solely to this email program. I 
> went through the script already to check indentation. Ok.

OK, I'll take your word for it.

> When importing this module in idle I get the following error:

> >>> import update
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "update.py", line 63, in ?
>     class TextExtractor:
>   File "update.py", line 72, in TextExtractor
>     newhtml = re.findall(story, self.html)
> NameError: name 'story' is not defined

I don't understand it either but since storty is a local 
variable why not try putting the string directly into the 
findall() and see if it works:

def crop(self):
  newhtml = re.findall("(?sx)%s.+%s" % ("<!--Storytext-->",
"<!--/Storytext-->"), 
                       self.html)

It might throw up something extra? Or even work! :-)

Alan g.