Anki Forums

Japanese Support

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.

i don’t know why it is not working, please help. :’(

Anki 2.1.34 (8af8f565) Python 3.8.0 Qt 5.15.1 PyQt 5.15.1
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-09-25 12:07:50

Unexpected output from mecab. Perhaps your Windows username contains non-Latin text?: ‘tagger.cpp(151) [load_dictionary_resource(param)] param.cpp(71) [ifs] no such file or directory: C:\Users\��\AppData\Roaming\Anki2\addons21\3918629684\support\mecabrc’

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