[Tutor] finding mismatched or unpaired html tags

Kent Johnson kent37 at tds.net
Tue Apr 28 17:17:46 CEST 2009

On Tue, Apr 28, 2009 at 10:41 AM, Dinesh B Vadhia
<dineshbvadhia at hotmail.com> wrote:
> This is the error and traceback:
> Unexpected error opening J:/F2/....html: mismatched tag: line 124, column 8
> Traceback (most recent call last):
>   File "C:\....py", line 492, in <module>
>     raw = extractText(xhtmlfile)
>   File "C:\....py", line 334, in extractText
>     tree = make_tree(xhtmlfile)
>   File "....py", line 169, in make_tree
>     return tree
> UnboundLocalError: local variable 'tree' referenced before assignment

This is inconsistent. The exception in the stack trace is from a
coding error in extractText. It looks like maybe ExtractText is
catching exceptions and printing them, and a bug in the exception
handling is causing the UnboundLocalError

> Here is line 124, col 8 and I cannot see any obvious missing/mismatched
> tags:
> "<p>As to the present time I am unable physical and mentally to secure all
> this information at present.</p>"

If you look at a few more lines do you see anything untoward? Perhaps
there is a missing </b> before the <p>, for example? I don't think <p>
is allowed inside every tag.


More information about the Tutor mailing list