jdlorimer / chinese-support-redux

Anki add-on providing support for Chinese study
https://ankiweb.net/shared/info/1128979221
GNU General Public License v3.0
101 stars 50 forks source link

Multiple errors related to autofill #95

Open akavi1 opened 5 years ago

akavi1 commented 5 years ago

Describe the bug Add-on does what it is supposed to do but I still get an error. The Autofill feature works as expected. But I get an error regardless every time I press tab on Hanzi. This error does not pop up if I press tab on the Pinyin field instead of Hanzi, but when I do this, only the Ruby fields are filled.

To Reproduce Steps to reproduce the behavior:

  1. I converted the cards in one of my decks to Chinese (Advanced). The Hanzi, Color, Pinyin, and English fields filled with info already on the note
  2. Click on Hanzi field and press tab.
  3. Remaining fields autofill but error also appears

Expected behavior I would not expect the error popup to come up. Also, the bulk fill should fill all the cards with Sound but

Screenshots If applicable, add screenshots to help explain your problem.

Before: image image

After: image image

Specs (please complete the following information):

Additional context Debug info: Anki 2.1.12 (eef86bf3) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3 Platform: Mac 10.14.6 Flags: frz=True ao=True sv=1 Add-ons possibly involved: Chinese Support Redux v0115

--- Logging error --- Traceback (most recent call last): File "logging/init.py", line 996, in emit UnicodeEncodeError: 'ascii' codec can't encode character '\u5462' in position 96: ordinal not in range(128) Call stack: File "runankimac", line 12, in File "aqt/init.py", line 276, in run File "aqt/init.py", line 363, in _run File "aqt/webview.py", line 27, in cmd File "aqt/webview.py", line 85, in _onCmd File "aqt/webview.py", line 363, in _onBridgeCmd File "aqt/editor.py", line 273, in onBridgeCmd File "anki/hooks.py", line 39, in runFilter File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/edit.py", line 74, in onFocusLost if update_fields(note, field, allFields): File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 267, in update_fields fill_sound(hanzi, copy) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 169, in fill_sound s = sound(hanzi, config['speech']) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/sound.py", line 48, in sound return '[sound:%s]' % download(hanzi, source) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/tts.py", line 37, in download tts.save(path) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/lib/gtts/tts.py", line 243, in save self.write_to_fp(f) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/lib/gtts/tts.py", line 200, in write_to_fp log.debug("payload-%i: %s", idx, payload) File "logging/init.py", line 1296, in debug File "logging/init.py", line 1444, in _log File "logging/init.py", line 1454, in handle File "logging/init.py", line 1516, in callHandlers File "logging/init.py", line 865, in handle File "logging/init.py", line 1072, in emit File "logging/init.py", line 1000, in emit Unable to print the message and arguments - possible formatting error. Use the traceback above to help find the error. --- Logging error --- Traceback (most recent call last): File "logging/init.py", line 996, in emit UnicodeEncodeError: 'ascii' codec can't encode character '\u5462' in position 182: ordinal not in range(128) Call stack: File "runankimac", line 12, in File "aqt/init.py", line 276, in run File "aqt/init.py", line 363, in _run File "aqt/webview.py", line 27, in cmd File "aqt/webview.py", line 85, in _onCmd File "aqt/webview.py", line 363, in _onBridgeCmd File "aqt/editor.py", line 273, in onBridgeCmd File "anki/hooks.py", line 39, in runFilter File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/edit.py", line 74, in onFocusLost if update_fields(note, field, allFields): File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 267, in update_fields fill_sound(hanzi, copy) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 169, in fill_sound s = sound(hanzi, config['speech']) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/sound.py", line 48, in sound return '[sound:%s]' % download(hanzi, source) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/tts.py", line 37, in download tts.save(path) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/lib/gtts/tts.py", line 243, in save self.write_to_fp(f) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/lib/gtts/tts.py", line 226, in write_to_fp log.debug("part-%i written to %s", idx, fp) File "logging/init.py", line 1296, in debug File "logging/init.py", line 1444, in _log File "logging/init.py", line 1454, in handle File "logging/init.py", line 1516, in callHandlers File "logging/init.py", line 865, in handle File "logging/init.py", line 1072, in emit File "logging/init.py", line 1000, in emit Unable to print the message and arguments - possible formatting error. Use the traceback above to help find the error. --- Logging error --- Traceback (most recent call last): File "logging/init.py", line 996, in emit UnicodeEncodeError: 'ascii' codec can't encode character '\u5462' in position 140: ordinal not in range(128) Call stack: File "runankimac", line 12, in File "aqt/init.py", line 276, in run File "aqt/init.py", line 363, in _run File "aqt/webview.py", line 27, in cmd File "aqt/webview.py", line 85, in _onCmd File "aqt/webview.py", line 363, in _onBridgeCmd File "aqt/editor.py", line 273, in onBridgeCmd File "anki/hooks.py", line 39, in runFilter File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/edit.py", line 74, in onFocusLost if update_fields(note, field, allFields): File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 267, in update_fields fill_sound(hanzi, copy) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 169, in fill_sound s = sound(hanzi, config['speech']) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/sound.py", line 48, in sound return '[sound:%s]' % download(hanzi, source) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/tts.py", line 37, in download tts.save(path) File "/Users/anujkavi/Library/Application Support/Anki2/addons21/1128979221/lib/gtts/tts.py", line 244, in save log.debug("Saved to %s", savefile) File "logging/init.py", line 1296, in debug File "logging/init.py", line 1444, in _log File "logging/init.py", line 1454, in handle File "logging/init.py", line 1516, in callHandlers File "logging/init.py", line 865, in handle File "logging/init.py", line 1072, in emit File "logging/init.py", line 1000, in emit Unable to print the message and arguments - possible formatting error. Use the traceback above to help find the error.

jorschneider commented 4 years ago

same here. it used to be that getting voice files crashed this, but now even filling out pinyin gives me this error

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.14 (7b93e985) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3 Platform: Mac 10.14.5 Flags: frz=True ao=True sv=1 Add-ons possibly involved: Chinese Support Redux v0115

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/jordanschneider/Library/Application Support/Anki2/addons21/1128979221/edit.py", line 74, in onFocusLost if update_fields(note, field, allFields): File "/Users/jordanschneider/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 267, in update_fields fill_sound(hanzi, copy) File "/Users/jordanschneider/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 169, in fill_sound s = sound(hanzi, config['speech']) File "/Users/jordanschneider/Library/Application Support/Anki2/addons21/1128979221/sound.py", line 38, in sound if source.count('|') != 1: <class 'AttributeError'>: 'NoneType' object has no attribute 'count'

newslate commented 4 years ago

I'm also having this issue. Problem can be replicated by starting with Chinese Support off, Opening add new card window, Type some NEW Chinese phrase in the Hanzi field, then Toggle Chinese Support button on, Tab out of the Hanzi field. Fields populate fine but there is an annoying error message. Appreciate your help on this, thanks.

Debug info: Anki 2.1.15 (442df9d6) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3 Platform: Windows 10 Flags: frz=True ao=True sv=1

--- Logging error --- Traceback (most recent call last): File "logging__init.py", line 996, in emit File "C:\Program Files\Python36\lib\encodings\cp1252.py", line 19, in encode UnicodeEncodeError: 'charmap' codec can't encode characters in position 96-97: character maps to Call stack: File "runanki", line 4, in File "aqt__init.py", line 276, in run File "aqt__init.py", line 364, in _run 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 "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\edit.py", line 74, in onFocusLost if update_fields(note, field, allFields): File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 267, in update_fields fill_sound(hanzi, copy) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 169, in fill_sound s = sound(hanzi, config['speech']) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\sound.py", line 48, in sound return '[sound:%s]' % download(hanzi, source) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\tts.py", line 37, in download tts.save(path) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\lib\gtts\tts.py", line 243, in save self.write_to_fp(f) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\lib\gtts\tts.py", line 200, in write_to_fp log.debug("payload-%i: %s", idx, payload) File "logging__init.py", line 1296, in debug File "logging__init.py", line 1444, in _log File "logging__init.py", line 1454, in handle File "logging\init.py", line 1516, in callHandlers File "logging\init.py", line 865, in handle File "logging\init.py", line 1072, in emit File "logging\init.py", line 1000, in emit Message: 'payload-%i: %s' Arguments: (0, {'ie': 'UTF-8', 'q': '怎麽', 'tl': 'zh-tw', 'ttsspeed': 1, 'total': 1, 'idx': 0, 'client': 'tw-ob', 'textlen': 2, 'tk': '484996.118073'}) --- Logging error --- Traceback (most recent call last): File "logging\init.py", line 996, in emit File "C:\Program Files\Python36\lib\encodings\cp1252.py", line 19, in encode UnicodeEncodeError: 'charmap' codec can't encode characters in position 183-184: character maps to Call stack: File "runanki", line 4, in File "aqt\init.py", line 276, in run File "aqt\init__.py", line 364, in _run 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 "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\edit.py", line 74, in onFocusLost if update_fields(note, field, allFields): File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 267, in update_fields fill_sound(hanzi, copy) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 169, in fill_sound s = sound(hanzi, config['speech']) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\sound.py", line 48, in sound return '[sound:%s]' % download(hanzi, source) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\tts.py", line 37, in download tts.save(path) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\lib\gtts\tts.py", line 243, in save self.write_to_fp(f) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\lib\gtts\tts.py", line 226, in write_to_fp log.debug("part-%i written to %s", idx, fp) File "logging\init.py", line 1296, in debug File "logging\init__.py", line 1444, in _log File "logging\init.py", line 1454, in handle File "logging\init.py", line 1516, in callHandlers File "logging\init.py", line 865, in handle File "logging\init.py", line 1072, in emit File "logging\init__.py", line 1000, in emit Message: 'part-%i written to %s' Arguments: (0, <_io.BufferedWriter name='C:\\Users\\Surface Book\\AppData\\Roaming\\Anki2\\User 1\\collection.media\\怎麽_google_zh-tw.mp3'>) --- Logging error --- Traceback (most recent call last): File "logging\init.py", line 996, in emit File "C:\Program Files\Python36\lib\encodings\cp1252.py", line 19, in encode UnicodeEncodeError: 'charmap' codec can't encode characters in position 133-134: character maps to Call stack: File "runanki", line 4, in File "aqt\init.py", line 276, in run File "aqt\init__.py", line 364, in _run 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 "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\edit.py", line 74, in onFocusLost if update_fields(note, field, allFields): File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 267, in update_fields fill_sound(hanzi, copy) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 169, in fill_sound s = sound(hanzi, config['speech']) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\sound.py", line 48, in sound return '[sound:%s]' % download(hanzi, source) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\tts.py", line 37, in download tts.save(path) File "C:\Users\Surface Book\AppData\Roaming\Anki2\addons21\1128979221\lib\gtts\tts.py", line 244, in save log.debug("Saved to %s", savefile) File "logging\init.py", line 1296, in debug File "logging\init__.py", line 1444, in _log File "logging\init.py", line 1454, in handle File "logging\init.py", line 1516, in callHandlers File "logging\init.py", line 865, in handle File "logging\init.py", line 1072, in emit File "logging\init__.py", line 1000, in emit Message: 'Saved to %s' Arguments: ('C:\Users\Surface Book\AppData\Roaming\Anki2\User 1\collection.media\怎麽_google_zh-tw.mp3',)

ShylpVII commented 4 years ago

I also have this issue, but just a few times per sessions rather than every time. Especially when opening the Browser parallel to the ‘add new card’-tab. In My case there might be some conflict with Frozen Fields and Ze add note ID.

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.15.1 Flags: frz=True ao=True sv=1 Add-ons possibly involved: Ze Add note id, Chinese Support Redux v0115, Frozen Fields

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 "", line 2, in onBridgeCmd File "anki/hooks.py", line 74, in decorator_wrapper File "anki/hooks.py", line 71, in repl File "/Users/Joshua/Library/Application Support/Anki2/addons21/516643804/main.py", line 212, in onBridge return _old(self, str) File "aqt/editor.py", line 273, in onBridgeCmd File "anki/hooks.py", line 39, in runFilter File "/Users/Joshua/Library/Application Support/Anki2/addons21/1128979221/edit.py", line 78, in onFocusLost self.editor.loadNote(focusTo=index+1) File "", line 2, in loadNote21 File "anki/hooks.py", line 74, in decorator_wrapper File "anki/hooks.py", line 68, in repl File "/Users/Joshua/Library/Application Support/Anki2/addons21/886709118/init.py", line 87, in onLoadNote for f in self.note.keys(): <class 'AttributeError'>: 'NoneType' object has no attribute 'keys'

jdlorimer commented 4 years ago

From what I can tell, there are 3 different bugs here. The one mentioned by @jorschneider is addressed in the next release. We'll wait and see if the others are also fixed.

jorschneider commented 4 years ago

woo! looking forward

On Sun, Dec 15, 2019 at 3:22 PM Joseph Lorimer notifications@github.com wrote:

From what I can tell, there are 3 different bugs here. The one mentioned by @jorschneider https://github.com/jorschneider is addressed in the next release. We'll wait and see if the others are also fixed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/luoliyan/chinese-support-redux/issues/95?email_source=notifications&email_token=AM2TMXJVV26UESVHNHARFBTQYXLJTA5CNFSM4I3PCXW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG4TAMY#issuecomment-565784627, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM2TMXPUP7SRIXVGGG5VH7LQYXLJTANCNFSM4I3PCXWQ .

haanhle commented 3 years ago

someone please fix it 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-on support site. Debug info: Anki 2.1.34 (8af8f565) Python 3.8.1 Qt 5.12.6 PyQt 5.12.3 Platform: Windows 8.1 Flags: frz=True ao=True sv=1 Add-ons, last update check: 2020-11-21 14:18:09

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 "aqt\editor.py", line 403, in onBridgeCmd File "aqt\gui_hooks.py", line 1487, in call File "lib\site-packages\anki\hooks.py", line 594, in runFilter File "C:\Users\My Documents\AppData\Roaming\Anki2\addons21\1128979221\edit.py", line 74, in onFocusLost if update_fields(note, field, allFields): File "C:\Users\My Documents\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 270, in update_fields fill_sound(hanzi, copy) File "C:\Users\My Documents\AppData\Roaming\Anki2\addons21\1128979221\behavior.py", line 169, in fill_sound s = sound(hanzi, config['speech']) File "C:\Users\My Documents\AppData\Roaming\Anki2\addons21\1128979221\sound.py", line 51, in sound return '[sound:%s]' % AudioDownloader(hanzi, source).download() File "C:\Users\My Documents\AppData\Roaming\Anki2\addons21\1128979221\tts.py", line 50, in download self.func() File "C:\Users\My Documents\AppData\Roaming\Anki2\addons21\1128979221\tts.py", line 56, in get_google tts.save(self.path) File "C:\Users\My Documents\AppData\Roaming\Anki2\addons21\1128979221\lib\gtts\tts.py", line 243, in save self.write_to_fp(f) File "C:\Users\My Documents\AppData\Roaming\Anki2\addons21\1128979221\lib\gtts\tts.py", line 183, in write_to_fp part_tk = self.token.calculate_token(part) File "C:\Users\My Documents\AppData\Roaming\Anki2\addons21\1128979221\lib\gtts_token\gtts_token.py", line 28, in calculate_token seed = self._get_token_key() File "C:\Users\My Documents\AppData\Roaming\Anki2\addons21\1128979221\lib\gtts_token\gtts_token.py", line 58, in _get_token_key raise ValueError( ValueError: Unable to find token seed! Did https://translate.google.com change?