summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Možina <martin.mozina@fri.uni-lj.si>2018-05-20 18:13:48 +0200
committerMartin Možina <martin.mozina@fri.uni-lj.si>2018-05-20 18:13:48 +0200
commit2678fc027f891ffafb31e5fd411342034c7362e5 (patch)
treef16adad2f81ae045216d9f74103f3ff74c85ea0e
parent8723bd7cd2d227634d67f24e9514d88e9f1c73a7 (diff)
Catch exception when files have non-utf characters.
-rw-r--r--main.py6
1 files 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)