Open turbodog opened 13 years ago
I saw this as well. This issue is fixed in python2.7 because of an update in HTMLParser. You should be able to backport the 2.7 version to fix this issue.
I created a backport and put it on Pypi. https://pypi.python.org/pypi/HTMLParser
>>>import html2text
>>>html2text.__version__
'3.02'
>>>html2text.html2text('<p')
Traceback (most recent call last):
File "", line 1, in
File "html2text.py", line 450, in html2text
File "html2text.py", line 447, in html2text_file
File "html2text.py", line 185, in close
File "C:\dev\python27\lib\HTMLParser.py", line 112, in close
File "C:\dev\python27\lib\HTMLParser.py", line 164, in goahead
File "C:\dev\python27\lib\HTMLParser.py", line 115, in error
HTMLParser.HTMLParseError: EOF in middle of construct, at line 1, column 1
Is it possible to append a '>' or drop the whole tag and retry without passing the exception up?
FWIW, first parsing the HTML with BeautifulSoup eliminates the unclosed tag and html2text suceeds.