diff --git a/pythonfuzz/dictionary.py b/pythonfuzz/dictionary.py index a33bc86..0b65f80 100644 --- a/pythonfuzz/dictionary.py +++ b/pythonfuzz/dictionary.py @@ -46,16 +46,19 @@ def load_file(self, dict_path): _dict = set() with open(dict_path) as f: - for line in f: + for nb, line in enumerate(f): line = line.lstrip() if not line or line.startswith('#'): continue word = self.line_re.search(line) - if word: - # Decode any escaped characters, giving us a bytes object - value = word.group(1) - (value, _) = codecs.escape_decode(value) - _dict.add(value) + if not word: + print('Error while loading the dictionary "%s" at line %d.' + % (dict_path, line)) + continue + # Decode any escaped characters, giving us a bytes object + value = word.group(1) + (value, _) = codecs.escape_decode(value) + _dict.add(value) self._dict = list(_dict) def get_word(self):