From 2678fc027f891ffafb31e5fd411342034c7362e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mo=C5=BEina?= Date: Sun, 20 May 2018 18:13:48 +0200 Subject: Catch exception when files have non-utf characters. --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index ecd2b75..30ec645 100644 --- a/main.py +++ b/main.py @@ -24,8 +24,10 @@ def get_programs(path: str, names: str, do_canonicalize: bool = False): for submission in os.listdir(user_dir): with open(os.path.join(user_dir, submission), 'r') as f: - code = f.read().strip() - + try: + code = f.read().strip() + except: + continue # skip syntactically incorrect programs try: ast.parse(code) -- cgit v1.2.1