From f298450fd0c74f041feae358bb7e5647504d6126 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 1 Aug 2016 21:53:06 +0300 Subject: [PATCH] Fix for Python 3: import html.parser and html.entities --- m_lib/net/www/html.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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): -- 2.39.5