[Tutor] Re: I'm drawing a blank here.. help please

Emile van Sebille emile@fenx.com
Wed, 21 Aug 2002 05:54:48 -0700


"S A"
>
>      def __init__(self, html, t):
>         self.html = html
>         self.t = t
>      def crop(self):
>            story = "(?sx)%s.+%s" % ("<!--Storytext-->",
"<!--/Storytext-->")
>            newhtml = re.findall(story, self.html)
>
> So when I instantiate this class with the values html and t(for time),
those values are passed onto self.html and self.t respectively. (self.t
will come up in a later class method) So, every time I try to run this
program that imports this module or import this module in idle I get the
following error:
>
> Traceback (most recent call last):
>   File "./fnewsupdate.py", line 3, in ?
>     from update import *
>   File "./update.py", line 63, in ?
>     class TextExtractor:
>   File "./update.py", line 73, in TextExtractor
>     newhtml = re.findall(story, self.html)
> NameError: name 'story' is not defined

I'd suspect inconsistent indentation, forcing that line into a different
scope where story is not defined.

--

Emile van Sebille
emile@fenx.com

---------