mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
fail gracefully if unihan.db is not available
This commit is contained in:
parent
6ce63b4889
commit
73767124d8
1 changed files with 8 additions and 5 deletions
|
@ -57,11 +57,14 @@ class ChineseGenerator(object):
|
|||
self.unihan = None
|
||||
|
||||
def toReading(self, type, val):
|
||||
try:
|
||||
if not self.unihan:
|
||||
self.unihan = UnihanController(type)
|
||||
else:
|
||||
self.unihan.type = type
|
||||
return self.unihan.reading(val)
|
||||
except:
|
||||
return u""
|
||||
|
||||
unihan = ChineseGenerator()
|
||||
|
||||
|
|
Loading…
Reference in a new issue