Bug: 'HTMLParser' object has no attribute 'unescape'

Since I modified the card template, on viewing the answer the following happens:

An error occurred. Please use Tools > Check Database to see if that fixes the problem.

If problems persist, please report the problem on our support site. Please copy and paste the information below into your report.

Anki 2.1.15 (442df9d6) Python 3.9.1 Qt 5.15.2 PyQt 5.15.0
Platform: Linux
Flags: frz=False ao=False sv=1

Caught exception:
File “/usr/share/anki/aqt/webview.py”, line 322, in handler
cb(val)
File “/usr/share/anki/aqt/reviewer.py”, line 461, in _onTypedAnswer
self._showAnswer()
File “/usr/share/anki/aqt/reviewer.py”, line 217, in _showAnswer
a = self._mungeQA(a)
File “/usr/share/anki/aqt/reviewer.py”, line 156, in _mungeQA
return self.typeAnsFilter(mungeQA(self.mw.col, buf))
File “/usr/share/anki/aqt/reviewer.py”, line 306, in typeAnsFilter
return self.typeAnsAnswerFilter(buf)
File “/usr/share/anki/aqt/reviewer.py”, line 362, in >typeAnsAnswerFilter
cor = parser.unescape(cor)
<class ‘AttributeError’>: ‘HTMLParser’ object has no attribute ‘unescape’

I checked the database and started with add-ons disabled, neither had an effect.

What I changed:
I added {{type:Front}} to the front of one card. The typing field displays and text can be entered.

Installing the latest Anki version will fix the issue.

Otherwise, edit /usr/share/anki/aqt/reviewer.py and replace

with

3 Likes

thank you, replacing this line in /usr/share/anki/aqt/reviewer.py solved the issue