From 5dfa427a15bdfea471850d28547b2da844e4cfbd Mon Sep 17 00:00:00 2001 From: Boleyn Su Date: Wed, 28 Oct 2020 21:16:33 +0900 Subject: [PATCH] fix breakage on python 3.9 This commit fixes "AttributeError: 'HTMLParser' object has no attribute 'unescape'" --- itchat/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/itchat/utils.py b/itchat/utils.py index e217368c..bd8eeb63 100644 --- a/itchat/utils.py +++ b/itchat/utils.py @@ -18,6 +18,9 @@ emojiRegex = re.compile(r'') htmlParser = HTMLParser() +if not hasattr(htmlParser, 'unescape'): + import html + htmlParser.unescape = html.unescape try: b = u'\u2588' sys.stdout.write(b + '\r')