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

Kent Johnson kent37 at tds.net
Fri Apr 10 23:19:29 CEST 2009

On Fri, Apr 10, 2009 at 5:08 PM, Sander Sweers <sander.sweers at gmail.com> wrote:
> 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 "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?

Read the bad url yourself and look at line 167, column 73? Or, catch
the exception, have the code find out where the error is and display
the bad line.


More information about the Tutor mailing list