Added try/except for setting dictionary

This commit is contained in:
Veronica K. B. Olsen
2019-09-14 13:44:51 +02:00
parent 5ae77bc637
commit 38509299ae
+9 -5
View File
@@ -32,11 +32,15 @@ class NWSpellEnchant(NWSpellCheck):
return return
def setLanguage(self, theLang, projectDict=None): def setLanguage(self, theLang, projectDict=None):
if projectDict is None: try:
self.theDict = enchant.Dict(theLang) if projectDict is None:
else: self.theDict = enchant.Dict(theLang)
self.theDict = enchant.DictWithPWL(theLang, projectDict) else:
logger.debug("Enchant spell checking for language %s loaded" % theLang) self.theDict = enchant.DictWithPWL(theLang, projectDict)
logger.debug("Enchant spell checking for language %s loaded" % theLang)
except:
logger.error("Failed to load enchant spell checking for language %s" % theLang)
self.theDict = None
return return
def checkWord(self, theWord): def checkWord(self, theWord):