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
|
self.unihan = None
|
||||||
|
|
||||||
def toReading(self, type, val):
|
def toReading(self, type, val):
|
||||||
if not self.unihan:
|
try:
|
||||||
self.unihan = UnihanController(type)
|
if not self.unihan:
|
||||||
else:
|
self.unihan = UnihanController(type)
|
||||||
self.unihan.type = type
|
else:
|
||||||
return self.unihan.reading(val)
|
self.unihan.type = type
|
||||||
|
return self.unihan.reading(val)
|
||||||
|
except:
|
||||||
|
return u""
|
||||||
|
|
||||||
unihan = ChineseGenerator()
|
unihan = ChineseGenerator()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue