Armor AutoCompleter against unicode errors #305

This commit is contained in:
Paul Gauthier 2023-11-03 07:26:21 -07:00
parent efb3f03a62
commit f3d3815201
3 changed files with 42 additions and 1 deletions

View file

@ -44,7 +44,7 @@ class AutoCompleter(Completer):
try:
with open(fname, "r", encoding=self.encoding) as f:
content = f.read()
except FileNotFoundError:
except (FileNotFoundError, UnicodeDecodeError):
continue
try:
lexer = guess_lexer_for_filename(fname, content)