summaryrefslogtreecommitdiff
path: root/kpov_judge/test_task.py
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2019-02-21 00:39:16 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2019-02-21 00:39:54 +0100
commit003e89608d5fd0ee13dbbe6f61654aeebebede43 (patch)
treef066824dea979cc4d3bf9e0afef785d8d7ab154b /kpov_judge/test_task.py
parentcd8fd82d09b3636c8667f64d6c3264ba18e118f9 (diff)
web.task_source: return the empty string for invalid task
Diffstat (limited to 'kpov_judge/test_task.py')
-rwxr-xr-xkpov_judge/test_task.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/kpov_judge/test_task.py b/kpov_judge/test_task.py
index a049bee..a1f3608 100755
--- a/kpov_judge/test_task.py
+++ b/kpov_judge/test_task.py
@@ -141,11 +141,12 @@ if __name__ == '__main__':
task_url = params['task_url']
task_name = params['task_name']
- source = urllib.request.urlopen("{task_url}/{task_name}/task.py".format(**params))
+ source = urllib.request.urlopen("{task_url}/{task_name}/task.py".format(**params)).read()
+ if not source:
+ raise Exception('no such task: {}'.format(task_name))
task, task_check, task_params_meta, gen_params = load_task(source)
except Exception as e:
- import traceback
- traceback.print_exc()
+ print(e)
with open(basic_args.params_file, 'w') as f:
yaml.dump(params, f)
exit(1)