Japanese Support

Have you ruled out both of these as the problem? What is your Windows username?

If you’re receiving errors about mecab, you may need to add an exception to your antivirus program for mecab.exe

If you receive a message about non-Latin text, it is because the reading support does not work when your Windows login name contains characters from other languages. If you create a new Windows login using A-Z characters, or rename your existing login folder (for advanced users only!), it should resolve the problem.

Hi!Thanks for the reply, and yes I have already ruled out both of the above mentioned problems. Is there anything else I can do to solve this?

Please see https://anki.tenderapp.com/discussions/ankidesktop/16366-error-trying-to-generate-readings

What antivirus program are you using? What do you see when running mecab.exe outside of Anki?

Hi, sorry to bother. I downloaded the add-on but somehow it not showing anywhere. I can see it when I click the add-on option on the tool section but when I want to add a new card, I can’t find the note type for japanese and furigana I don’t know why :(( I’ve already tried to delete it and download it again but it still doesn’t appear

p.d. I have the lastest version

Please make sure you restarted Anki, and added the note type by clicking on the Manage button as described in the instructions.

Hi there, first I want to say thank you so much for this amazing add-on. It has helped me so much. However, since yesterday I have been having some issues with it. I was able to come to the conclusion that this add-on was causing the below message to appear (by disabling other add-on’s until I found out it was this). The trigger is when I open Anki, try to add a new card, and then after typing in a new word in the “expressions” box I click tab to go to the next input box, and instead of smoothly allowing me to type there like usual, it delays for a few seconds, without inputting any furigana in the “reading” section. And then after about 10 seconds the below error message pops up.

This morning I tried to fix it by restarting my laptop, and it actually worked. But, this afternoon the problem came back, and restarting my laptop hasn’t solved it this time ):

I would truly appreciate your help in getting it to work again. It is by far my favorite add-on in anki.

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.22 (0ecc189a) 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-22 10:45:17

Caught exception:
Traceback (most recent call last):
File “aqt\webview.py”, line 31, in cmd
File “aqt\webview.py”, line 97, in _onCmd
File “aqt\webview.py”, line 500, in _onBridgeCmd
File “aqt\editor.py”, line 363, in onBridgeCmd
File “aqt\gui_hooks.py”, line 1006, in call
File “lib\site-packages\anki\hooks.py”, line 622, in runFilter
File “C:\Users\humza\AppData\Roaming\Anki2\addons21\3918629684\reading.py”, line 223, in onFocusLost
n[dst] = mecab.reading(srcTxt)
File “C:\Users\humza\AppData\Roaming\Anki2\addons21\3918629684\reading.py”, line 86, in reading
self.mecab.stdin.flush()
OSError: [Errno 22] Invalid argument

So each time you restart your laptop, it works for a while, and then stops working? The error seems to indicate the tool Anki uses to convert the kanji is failing. Do you use a third-party antivirus program?

Hi there Dae thanks so much for responding so quickly, I only just saw your reply.

Actually, the method of restarting my laptop only worked once a few days ago when the issue first arrived. Since then restarting hasn’t made the issue go away. (Perhaps that indicates the first time was a fluke?)
And to answer your question, no, I just have the regular “windows defender” that is built into windows 10.

Please try removing the add-on and reinstalling it. Does that help? If not, is there a mecab.exe file in the add-on’s folder?

Just did that now! When I restarted Anki to activate it, the same error happened again so I thought nothing changed. But after closing Anki one more time, and trying again, it works now!!
It seems pretty unstable for now so I might need to message you again if I can’t resolve a future issue by myself.
Thank you for your help Dae!

I tried to used Japanese Support and I get this error I already add mecab.exe to the exception in the antivirus but still the same problem I install and re installed the addon and same problem Im not sure what to do next can you please give me a hand ?

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.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-09 13:04:39

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 401, in onBridgeCmd
File “aqt\gui_hooks.py”, line 1487, in call
File “anki\hooks.py”, line 594, in runFilter
File “C:\Users\Rin\AppData\Roaming\Anki2\addons21\3918629684\reading.py”, line 223, in onFocusLost
n[dst] = mecab.reading(srcTxt)
File “C:\Users\Rin\AppData\Roaming\Anki2\addons21\3918629684\reading.py”, line 86, in reading
self.mecab.stdin.flush()
OSError: [Errno 22] Invalid argument

It’s most likely your antivirus. You may need to turn it off then install the add-on again. Please see

https://anki.tenderapp.com/discussions/ankidesktop/16366-error-trying-to-generate-readings#comment_38866898

https://anki.tenderapp.com/discussions/add-ons/14812-japanese-support-not-working

some reading for numbers doesn’t seems to fail to use the correct form automatically (hyaku/byaku/pyaku/sen/zen …)
it seems to not translate the number some time, for example : 三百 turn into 三 百[ひゃく]
but when mistake I found is 出口 that turn into 出口[いでぐち] instead of 出口[でぐち]
and 入り口 turn into 入り口[いりくち] instead of 入り口[いりぐち]

thanks

Haven’t used this, but the add-on page states that:

The reading generation is a timesaving device. Most of the time it will get the reading right, but it is not perfect. After the reading has been generated, you’ll need to read the generated text and make any necessary corrections.

There’s way too many exceptions especially with counters and rendaku for it to get everything correctly. I suppose it’s not using a dictionary, but just generating a possible reading. Although that disappearing character three sounds weird.

Is there anyway to add furigana for only specific words without this add-on? I only use furigana in like 5 cards out of a 1000, but it would be nice to have them in those cases, and working on mobile as well.

The furigana card template filter is supported on all platforms, but the text is expected to be in a particular format, so I recommend using the add-on to generate the reading rather than entering it in manually.

1 Like

I got stuck on this Invalid Argument OSError for a bit too, and it seems like I have a problem with mecab.exe itself crashing. I am using Windows 10. If I run it several times from command prompt, it will sometimes start successfully (where it waits for inputs), but sometimes it crashes at startup. I noticed I could track these crashes in the Event Viewer in Windows and they appear to be some kind of memory error. Given that it does work sometimes, I tried adding some simple retry logic to MecabController in reading.py as a workaround.

    def parseWithMecab(self, expr):
        """mecab.exe on Windows 10 will occasionally crash. Try up to 10 times."""
        for attempt in range(10):
            try:
                self.ensureOpen()
                self.mecab.stdin.write(expr.encode("utf-8", "ignore") + b'\n')
                self.mecab.stdin.flush()
                return self.mecab.stdout.readline().rstrip(b'\r\n').decode('utf-8', "replace")
            except OSError:
                self.mecab = None
        raise Exception("Could not communicate with {} - check your antivirus".format(self.mecabCmd))

And modified the beginning of reading accordingly.

    def reading(self, expr):
        expr = escapeText(expr)
        expr = self.parseWithMecab(expr)

I still see the crashes in event viewer, but readings are created correctly so this seems to be working for me.

Thanks daofma. I don’t recall other reports of intermittent errors - are you using an antivirus program or some other program that runs in the background? If it’s affecting multiple users then a retry loop might work as a workaround, but I’m not sure that makes sense if it’s a single system, and ideally we’d understand the error rather than plastering over it.

I certainly agree the best solution would be to have the program not crash at all. I only have Windows’ built-in Defender running and couldn’t find any reports of it having taken action, but I did find the crash reports. (I’m not sure if defender could do something to cause memory errors.) humza reported intermittent issues in this thread above. I think retrying/restarting a subprocess is a good practice - if the subprocess gets killed for some reason (however unlikely it may normally be), it’s good to keep the main application working. I guessed it could be due to ASLR (it seems like that is new in Windows 10), but after disabling it the crashes still happen. At least without ASLR the fault seems to occur at the same address each time, so it looks like something realistic to debug, but I am satisfied with the workaround and I don’t know how to do so on Windows, so I’m not planning to look into this further. I would be happy to share any more info or try other debugging steps if it’s helpful, though.

Faulting application name: mecab.exe, version: 0.0.0.0, time stamp: 0x4a21ec4d
Faulting module name: libmecab.dll, version: 0.0.0.0, time stamp: 0x4a21ec4a
Exception code: 0xc0000005
Fault offset: 0x00009946

Does the issue exist in the latest mecab? You should just need to copy the exe and dll into the add-on folder to test. https://taku910.github.io/mecab/#download