__all__ = ['parse_html']
-from HTMLParser import HTMLParseError
+try:
+ from HTMLParser import HTMLParseError
+except ImportError:
+ class HTMLParseError(Exception): pass
from m_lib.net.www.html import HTMLParser as _HTMLParser
def parse_html(html_text, charset=None, log=None):
+ if not html_text:
+ return None
parser = HTMLParser(charset)
try: