[Tutor] problems with HTMLParser
Sean 'Shaleh' Perry
shaleh@valinux.com
Tue, 23 Jan 2001 11:06:33 -0800
On Mon, Jan 22, 2001 at 06:23:05PM -0800, Daniel Yoo wrote:
> > > I call this simply:
> > >
> > > foo = myHTML(NullFormatter)
> ^^^^^^^^^^^^^
>
> It's this part --- you need to pass in an instance of a NullFormatter when
> doing stuff with HTMLParser:
>
> foo = myHTML(NullFormatter())
>
> Don't worry, I've seen this bug a LOT.
with the change mentioned above:
./import_toc.py
[('href', 'mailto:mdorman@debian.org')] # obviously start_a happens
Traceback (innermost last):
File "./import_toc.py", line 34, in ?
foo.feed(data)
File "/usr/lib/python1.5/sgmllib.py", line 83, in feed
self.goahead(0)
File "/usr/lib/python1.5/sgmllib.py", line 118, in goahead
k = self.parse_endtag(i)
File "/usr/lib/python1.5/sgmllib.py", line 271, in parse_endtag
self.finish_endtag(tag)
File "/usr/lib/python1.5/sgmllib.py", line 325, in finish_endtag
self.handle_endtag(tag, method)
File "/usr/lib/python1.5/sgmllib.py", line 336, in handle_endtag
method() # seems to die on end_a?
TypeError: not enough arguments; expected 2, got 1
gah, HTMLParser should not be this hard. Also, when I get this working
eventually I want the text wrapped in the anchor too, how do i get that?