Skip to content

Commit

Permalink
Fixed 'HTMLParser' object has no attribute 'unescape'.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjschroeder committed Dec 11, 2020
1 parent ed5d689 commit ceb187d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions rainbowstream/py3patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@
if sys.version[0] == "2":
from HTMLParser import HTMLParser
from urllib2 import URLError
unescape = HTMLParser().unescape
else:
from html.parser import HTMLParser
from urllib.error import URLError

unescape = HTMLParser().unescape
# According to https://github.com/python/cpython/blob/master/Lib/html/parser.py#L547 ,
# in python 3.5 maybe I should use
# from html import unescape
# but it is a far-future story:)

from html import unescape

# Function compatibility
# xrange, raw_input, map ,unicde
Expand Down

0 comments on commit ceb187d

Please sign in to comment.