Skip to content

Commit 0dc2142

Browse files
committed
Catch explicitly exception DictNotFoundError
1 parent 9ab0e22 commit 0dc2142

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

msgcheck.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ def add_message(self, numline_msgid, msgfuzzy, msg):
132132
self.props['language'] = match.group(1)
133133
if self.args.spelling:
134134
try:
135-
d = enchant.DictWithPWL(self.props['language'],
136-
self.args.pwl)
137-
self.checkers.append(SpellChecker(d))
138-
except:
135+
_dict = DictWithPWL(self.props['language'],
136+
self.args.pwl)
137+
self.checkers.append(SpellChecker(_dict))
138+
except DictNotFoundError:
139139
print(self.filename, ':', numline_msgid,
140140
': enchant dictionary not found for language ',
141141
self.props['language'],
@@ -144,9 +144,9 @@ def add_message(self, numline_msgid, msgfuzzy, msg):
144144
if self.args.dicts:
145145
for lang in self.args.dicts.split(','):
146146
try:
147-
d = enchant.Dict(lang)
148-
self.checkers.append(SpellChecker(d))
149-
except:
147+
_dict = Dict(lang)
148+
self.checkers.append(SpellChecker(_dict))
149+
except DictNotFoundError:
150150
print(self.filename,
151151
': enchant dictionary not found for '
152152
'language ',

0 commit comments

Comments
 (0)