[Python-modules-team] Bug#639307: python-html5lib: parse() with incorrect treebuilder -> unhelpful error message

Jakub Wilk jwilk at debian.org
Thu Aug 25 19:20:29 UTC 2011

Package: python-html5lib
Version: 0.90-2
Severity: wishlist

If I pass a treebuilder that doesn't exist to parse(), the exception message is
not very helpful:

>>> html5lib.parse(sys.stdin, treebuilder='lxm;') # <-- typo
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/lib/pymodules/python2.7/html5lib/html5parser.py", line 37, in parse
     p = HTMLParser(tb, namespaceHTMLElements=namespaceHTMLElements)
   File "/usr/lib/pymodules/python2.7/html5lib/html5parser.py", line 68, in __init__
     self.tree = tree(namespaceHTMLElements)
TypeError: 'NoneType' object is not callable

It would be nice if html5lib could throw an exception with a meaningful 
error message in such case.

-- System Information:
Debian Release: wheezy/sid
   APT prefers unstable
   APT policy: (990, 'unstable'), (500, 'experimental')
Architecture: i386 (x86_64)

Kernel: Linux 3.0.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=pl_PL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-html5lib depends on:
ii  python                        2.7.2-5    interactive high-level object-orie
ii  python-support                1.0.14     automated rebuilding support for P

Versions of packages python-html5lib suggests:
pn  python-beautifulsoup          <none>     (no description available)
ii  python-chardet                2.0.1-2    universal character encoding detec
pn  python-genshi                 <none>     (no description available)
ii  python-lxml                   2.3-0.1+b2 pythonic binding for the libxml2 a

Jakub Wilk

More information about the Python-modules-team mailing list