Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chinese Support 3 Auto Populate Not Working #84

Open
smiling-panda-888 opened this issue Jul 28, 2024 · 4 comments
Open

Chinese Support 3 Auto Populate Not Working #84

smiling-panda-888 opened this issue Jul 28, 2024 · 4 comments

Comments

@smiling-panda-888
Copy link

Describe the bug
Anki encounters a problem when I enter in the Hanzi and then press ' Tab' to auto-populate. Occassionally, this is resolved by restarting Anki, however the issue always comes back.

(Debug info below)

Anki 24.06.3 (d678e393) (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Windows-10-10.0.22631

Traceback (most recent call last):
File "aqt.webview", line 50, in cmd
File "aqt.webview", line 160, in _onCmd
File "aqt.webview", line 695, in _onBridgeCmd
File "aqt.editor", line 425, in onBridgeCmd
File "_aqt.hooks", line 2548, in call
File "anki.hooks", line 45, in runFilter
File "C:\Users\esemo\AppData\Roaming\Anki2\addons21\1752008591\edit.py", line 121, in onFocusLost
if not update_fields(note, field, allFields):
File "C:\Users\esemo\AppData\Roaming\Anki2\addons21\1752008591\behavior.py", line 352, in update_fields
fill_sound(hanzi, copy)
File "C:\Users\esemo\AppData\Roaming\Anki2\addons21\1752008591\behavior.py", line 246, in fill_sound
s = sound(hanzi, config['speech'])
File "C:\Users\esemo\AppData\Roaming\Anki2\addons21\1752008591\sound.py", line 51, in sound
return '[sound:%s]' % AudioDownloader(hanzi, source).download()
File "C:\Users\esemo\AppData\Roaming\Anki2\addons21\1752008591\tts.py", line 52, in download
self.func()
File "C:\Users\esemo\AppData\Roaming\Anki2\addons21\1752008591\tts.py", line 59, in get_google
tts.save(self.path)
File "C:\Users\esemo\AppData\Roaming\Anki2\addons21\1752008591\lib\gtts\tts.py", line 312, in save
with open(str(savefile), 'wb') as f:
OSError: [Errno 22] Invalid argument: 'C:\Users\esemo\AppData\Roaming\Anki2\User 1\collection.media\我觉得厅和说还可以,\n读和写不好, 很多字我都不知道是什么意思_google_zh-CN.mp3'

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Chinese Support 3 ['1752008591', 2024-02-25T10:37, 'None', mod]

===IDs of active AnkiWeb add-ons===
1752008591

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])


Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
Anki_ChineseSupport_Error

Specs (please complete the following information):

  • OS: Windows
  • Anki Version 24.06.3 (d678e393)⁩
  • Chinese Support 3 v0.17.1

The auto populate used to work for me, but has recently given me issues for some reason.

@kieranlblack
Copy link
Contributor

Hi, could you send the raw html from the Hanzi field? It looks like a \ is being inserted for a newline character. Is it multiline?

@smiling-panda-888
Copy link
Author

我觉得厅和说还可以, 读和写不好, 很多字我都不知道是什么意思。

Hanzi HTLM

Is this what you are looking for?

@kieranlblack
Copy link
Contributor

Yup that's it. The newline in the field after the comma is messing with the plugin since it doesn't totally sanitize this input for a path. For the time being you can work around this by not using newlines, try using a <br /> instead or just remove the line break entirely.

ps from one Chinese learner to another you might want to check that 厅 is the right character there 😉

@smiling-panda-888
Copy link
Author

Yup that's it. The newline in the field after the comma is messing with the plugin since it doesn't totally sanitize this input for a path. For the time being you can work around this by not using newlines, try using a <br /> instead or just remove the line break entirely.

ps from one Chinese learner to another you might want to check that 厅 is the right character there 😉

Thanks man this solved the issue. Super helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants