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

S A buc40@bemail.org
Tue, 20 Aug 2002 21:06:09 -0700


Hi Everyone-

Arggghhh!!!

Ok. Sorry, I had to vent a little frustration there. I've been hammering away at this code for awhile and no matter what I try I get the same error.

But first, a little prep for you:

I have this module I'm writing that containst the class TextExtractor.
The following two defs are the first two methods in the class:

     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

When I try to import the module in idle, it imports every class in the module except TextExtractor.

Is not story defined as the string "(?sx)<!--Storytext-->.+<!--/Storytext-->"?

If not, what am I doing wrong here?

Thanks in advance.
SA




"I can do everything on my Mac that I used to do on my PC, plus alot more ..."

-Me

------------------------------------------------------------
Free, BeOS-friendly email accounts: http://BeMail.org/
BeOS News and Community: http://www.BeGroovy.com/


---------------------------------------------------------------------
Express yourself with a super cool email address from BigMailBox.com.
Hundreds of choices. It's free!
http://www.bigmailbox.com
---------------------------------------------------------------------