Skip to content

Commit 5dfa427

Browse files
authored
fix breakage on python 3.9
This commit fixes "AttributeError: 'HTMLParser' object has no attribute 'unescape'"
1 parent d5ce5db commit 5dfa427

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

itchat/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
emojiRegex = re.compile(r'<span class="emoji emoji(.{1,10})"></span>')
2020
htmlParser = HTMLParser()
21+
if not hasattr(htmlParser, 'unescape'):
22+
import html
23+
htmlParser.unescape = html.unescape
2124
try:
2225
b = u'\u2588'
2326
sys.stdout.write(b + '\r')

0 commit comments

Comments
 (0)