migaku-official / Migaku-Dictionary-Addon

Migaku Dictionary allows users to lookup word definitions, export definitions to their cards in real-time, hear word audio and see word frequency, etc. If you have an issue please report it in the "Issues" tab. Reponses to issues can be slow on GitHub, for faster support consider joining our Discord server through our Patreon page.
GNU General Public License v3.0
64 stars 24 forks source link

KeyError: "undefined character name 'COMBINING APOSTROPHE'" #36

Open Irio opened 4 years ago

Irio commented 4 years ago

Type:

Environment:

I'm going to open a PR to resolve the issue:

Description:

I didn't isolate exactly how to reproduce it, but I noticed that the error appears when I finish reviewing my cards, in a session where I used the dictionary. My cards have text in both German and English.

image

Error 
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed. 
If the issue only occurs when add-ons are enabled, please use the Tools>Add-ons menu item to disable some add-ons and restart Anki, repeat until you discover the add-on that is causing the problem. 
When you've discovered the add-on that is causing the problem, please report the issue on the add-ons section of our support site. 
Debug info:
Anki 2.1.22 (0ecc189a) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2020-07-01 21:53:11

Unhandled exception in listener callback
Traceback (most recent call last):
  File "C:\Users\irio\AppData\Roaming\Anki2\addons21\1655992655\pynput\_util\__init__.py", line 162, in inner
    return f(self, *args, **kwargs)
  File "C:\Users\irio\AppData\Roaming\Anki2\addons21\1655992655\pynput\keyboard\_win32.py", line 236, in _process
    key = self._event_to_key(msg, vk)
  File "C:\Users\irio\AppData\Roaming\Anki2\addons21\1655992655\pynput\keyboard\_win32.py", line 267, in _event_to_key
    key = KeyCode(**self._translate(
  File "C:\Users\irio\AppData\Roaming\Anki2\addons21\1655992655\pynput\keyboard\_base.py", line 49, in __init__
    self.combining = unicodedata.lookup(
KeyError: "undefined character name 'COMBINING APOSTROPHE'"
FearrMe commented 4 years ago

Easily reproducable with US-International keyboard layout by pressing the '/" key.

FearrMe commented 4 years ago

Hid the error locally by using this fix, no idea if this breaks anything or if a fix was even necessary in the first place, so I won't be opening a PR.

edit: this 'fix' breaks ", trying to type " turns it into '"

FearrMe commented 3 years ago

Still broken, reportedly fixed in pynput 1.7.0 but simply changing the library breaks all keyboard input, not sure how the implementation works but updating pynput from 1.4.4 to at least 1.7.0 - if possible - would be greatly appreciated