jdlorimer/chinese-support-redux

Error when Using Jyutping Romanization

Opened this issue · 4 comments

Describe the bug

I get the following error when I try to use Jyutping Romanization:

Debug info:
Anki 2.1.29 (bbff62bf) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-08-26 23:27:15

Caught exception:
Traceback (most recent call last):
File "aqt\webview.py", line 37, in cmd
File "aqt\webview.py", line 123, in _onCmd
File "aqt\webview.py", line 544, in _onBridgeCmd
File "<C:\Program Files\Anki\decorator.pyc:decorator-gen-6>", line 2, in onBridgeCmd
File "lib\site-packages\anki\hooks.py", line 638, in decorator_wrapper
File "lib\site-packages\anki\hooks.py", line 635, in repl
File "C:\Users\arthu\AppData\Roaming\Anki2\addons21\516643804\main.py", line 135, in onBridge
return _old(self, str)
File "aqt\editor.py", line 397, in onBridgeCmd
File "aqt\gui_hooks.py", line 1467, in call
File "lib\site-packages\anki\hooks.py", line 594, in runFilter
File "C:\Users\arthu\AppData\Roaming\Anki2\addons21\1128979221\edit.py", line 74, in onFocusLost
if update_fields(note, field, allFields):
File "C:\Users\arthu\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 269, in update_fields
fill_color(hanzi, copy)
File "C:\Users\arthu\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 156, in fill_color
field = get_first(config['fields'][field_group], note)
KeyError: 'jyutping'

To Reproduce
On the Anki menu, click Chinese -> Phonetics -> Jyutping. Then Add Cards, select Chinese (basic) as the note type, and make sure that the Hanzi button is activated. Paste 靚衫 into the Hanzi field, and deselect the field.

Expected behavior
I expected the Pinyin field to fill with the Jyutping romanization, leng3 saam1.

Specs (please complete the following information):

  • OS: Windows 10
  • Anki Version: 2.1.29
  • Chinese Support Version: v0.14.0
p2635 commented

@aulchen I think Pinyin is for pinyin. Can you try either creating a new note type based on Chinese (basic) but rename the Pinyin field to one of the below (without the double quotes):

"Cantonese",
"广东话",
"广州话",
"廣州話",
"廣東話",
"粤",
"粤拼",
"粤语",
"粵",
"粵拼",
"粵語"

See if that works.

I tried it, didn't work. I changed the name of the Pinyin field in the Chinese (basic) note type to Cantonese, pressed the 汉字 button, input 你好 into the Hanzi field, pressed the Hanzi button, and deselected the Hanzi field, but the following error popped up:

Debug info:
Anki 2.1.33 (3f403040) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-09-19 01:10:11

Caught exception:
Traceback (most recent call last):
File "aqt\webview.py", line 37, in cmd
File "aqt\webview.py", line 123, in _onCmd
File "aqt\webview.py", line 547, in _onBridgeCmd
File "<C:\Program Files\Anki\decorator.pyc:decorator-gen-6>", line 2, in onBridgeCmd
File "anki\hooks.py", line 638, in decorator_wrapper
File "anki\hooks.py", line 635, in repl
File "C:\Users\arthu\AppData\Roaming\Anki2\addons21\516643804\main.py", line 135, in onBridge
return _old(self, str)
File "aqt\editor.py", line 401, in onBridgeCmd
File "aqt\gui_hooks.py", line 1487, in call
File "anki\hooks.py", line 594, in runFilter
File "C:\Users\arthu\AppData\Roaming\Anki2\addons21\1128979221\edit.py", line 74, in onFocusLost
if update_fields(note, field, allFields):
File "C:\Users\arthu\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 269, in update_fields
fill_color(hanzi, copy)
File "C:\Users\arthu\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 156, in fill_color
field = get_first(config['fields'][field_group], note)
KeyError: 'jyutping'

Encountering the same issue on OS X 10.12.6, Anki 2.1.15 and Chinese Support Redux v0.14.0

Debug Info:

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, repeating 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.15 (442df9d6) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3
Platform: Mac 10.12.6
Flags: frz=True ao=True sv=1
Add-ons possibly involved: Chinese Support Redux v0140

Caught exception:
File "aqt/webview.py", line 27, in cmd
File "aqt/webview.py", line 87, in _onCmd
File "aqt/webview.py", line 368, in _onBridgeCmd
File "aqt/editor.py", line 273, in onBridgeCmd
File "anki/hooks.py", line 39, in runFilter
File "/Users/kailin/Library/Application Support/Anki2/addons21/1128979221/edit.py", line 74, in onFocusLost
if update_fields(note, field, allFields):
File "/Users/kailin/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 269, in update_fields
fill_color(hanzi, copy)
File "/Users/kailin/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 156, in fill_color
field = get_first(config['fields'][field_group], note)
<class 'KeyError'>: 'jyutping'

Jyutping is currently known to have issues. My apologies for the inconvenience.