Skip to content

Commit 971bd31

Browse files
committed
Handle Unicode errors gracefully
1 parent f354baa commit 971bd31

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎language_check/main.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ def main():
8686
motherTongue=args.mother_tongue)
8787
guess_language = None
8888

89-
text = get_text(filename, encoding, ignore=args.ignore_lines)
89+
try:
90+
text = get_text(filename, encoding, ignore=args.ignore_lines)
91+
except UnicodeError as exception:
92+
print('{}: {}'.format(filename, exception), file=sys.stderr)
93+
continue
9094

9195
if args.language:
9296
if args.language.lower() == 'auto':

0 commit comments

Comments
 (0)