[Tutor] Make beautifulsoup show the data it has an issue with

Sander Sweers sander.sweers at gmail.com
Fri Apr 10 23:08:55 CEST 2009


Hello Tutors,

I am having some issues with a malformed tag in a html page.
BeautifulSoup barfs with the following.

raceback (most recent call last):
  File "<pyshell#140>", line 1, in <module>
    tsoup = BeautifulSoup(readPage('http://url.sanitized'))
  File "C:\Python25\lib\site-packages\BeautifulSoup.py", line 1493, in __init__
    BeautifulStoneSoup.__init__(self, *args, **kwargs)
  File "C:\Python25\lib\site-packages\BeautifulSoup.py", line 1224, in __init__
    self._feed(isHTML=isHTML)
  File "C:\Python25\lib\site-packages\BeautifulSoup.py", line 1257, in _feed
    self.builder.feed(markup)
  File "C:\Python25\lib\HTMLParser.py", line 108, in feed
    self.goahead(0)
  File "C:\Python25\lib\HTMLParser.py", line 148, in goahead
    k = self.parse_starttag(i)
  File "C:\Python25\lib\HTMLParser.py", line 226, in parse_starttag
    endpos = self.check_for_whole_start_tag(i)
  File "C:\Python25\lib\HTMLParser.py", line 301, in check_for_whole_start_tag
    self.error("malformed start tag")
  File "C:\Python25\lib\HTMLParser.py", line 115, in error
    raise HTMLParseError(message, self.getpos())
HTMLParseError: malformed start tag, at line 167, column 73

How can I make it return the data it has an issue with?

Thanks
Sander


More information about the Tutor mailing list