Skip to content

Commit c8d78c4

Browse files
committed
don't get confused by python-future making Python 3 package names available under Python 2 (but only with Python 2 functionality)
1 parent c847239 commit c8d78c4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

roundup/dehtml.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from __future__ import print_function
33
from roundup.anypy.strings import u2s, uchr
44

5+
import sys
6+
_pyver = sys.version_info[0]
57

68
class dehtml:
79
def __init__(self, converter):
@@ -32,12 +34,10 @@ def html2text(html):
3234
# Python 3+.
3335
from html.parser import HTMLParser
3436
from html.entities import name2codepoint
35-
pyver = 3
3637
except ImportError:
3738
# Python 2.
3839
from HTMLParser import HTMLParser
3940
from htmlentitydefs import name2codepoint
40-
pyver = 2
4141

4242
class DumbHTMLParser(HTMLParser):
4343
# class attribute
@@ -83,7 +83,7 @@ def handle_entityref(self, name):
8383
self.text = self.text + ' '
8484

8585
def html2text(html):
86-
if pyver == 3:
86+
if _pyver == 3:
8787
parser = DumbHTMLParser(convert_charrefs=True)
8888
else:
8989
parser = DumbHTMLParser()

0 commit comments

Comments
 (0)