How to Improve KeyError When Running pykakasi

Asked 2 years ago, Updated 2 years ago, 39 views

I'd like to convert Japanese to romaji using pykakasi in python.
When I try to do it, I get the following error:

KeyError: 'pykakasi\\hepburnhira2.pickle'

There was information that pykakasi gets an error when installing with pip, so
I installed it directly from the github repository without using pip.

from pykakasi import kakasi
kakasi=kakasi()
kakasi.setMode('H', 'a')
kakasi.setMode('K', 'a')
kakasi.setMode('J', 'a')
conv=kakasi.getConverter()
result=conv.do("Japanese")
print(result)

Has anyone solved the same problem?

python python3 pykakasi

2022-09-30 19:18

1 Answers

If you look at pykakasi's GitHub Issu, there was a bug in the past that caused the error KeyError: 'pykakasi\hepburnhira2.pickle', but it has already been fixed.Also, I have tried installing the latest version of pykakasi, but there is no problem.

Just in case, uninstall the currently installed pykakasi and then

 pip uninstall pykakasi

I think it will work no matter how you install it.

 // From PyPI
pip install pykakasi
// From GitHub repository
pip install git + https://github.com/miurahr/pykakasi
// From GitHub release
pip install https://github.com/miurahr/pykakasi/archive/v0.93.zip


2022-09-30 19:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.