From: Oleg Broytman Date: Mon, 1 Aug 2016 18:53:06 +0000 (+0300) Subject: Fix for Python 3: import html.parser and html.entities X-Git-Tag: 3.0.1~1 X-Git-Url: https://git.phdru.name/?p=m_lib.git;a=commitdiff_plain;h=f298450fd0c74f041feae358bb7e5647504d6126 Fix for Python 3: import html.parser and html.entities --- diff --git a/m_lib/net/www/html.py b/m_lib/net/www/html.py index 723f0c0..c5d9d03 100644 --- a/m_lib/net/www/html.py +++ b/m_lib/net/www/html.py @@ -1,8 +1,12 @@ """HTML parsers""" -from HTMLParser import HTMLParser as _HTMLParser -from htmlentitydefs import entitydefs +try: + from html.parser import HTMLParser as _HTMLParser + from html.entities import entitydefs +except ImportError: + from HTMLParser import HTMLParser as _HTMLParser + from htmlentitydefs import entitydefs def join_attrs(attrs):