summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-02 13:11:15 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-02 13:14:42 +0200
commitab86aa7480698928e85b55d669edcec2a960a265 (patch)
tree70dc4e8782784cb85a859815cceb15a9a5f999fb
parent5792ebcdd354eb858eb696323b7840c10c4fbfb1 (diff)
test_task.py: fix loading parameters from web for older Pythons
-rwxr-xr-xkpov_judge/test_task.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/kpov_judge/test_task.py b/kpov_judge/test_task.py
index d79c0e5..3fad962 100755
--- a/kpov_judge/test_task.py
+++ b/kpov_judge/test_task.py
@@ -1,10 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
+import io
import yaml
import json
import urllib.request, urllib.parse, urllib.error
-import urllib.request, urllib.error, urllib.parse
try:
from dialog import Dialog
except:
@@ -192,8 +192,8 @@ if __name__ == '__main__':
task_params.update(gen_params(params['username'], task_params_meta))
# print ("params after: {} {}".format(params, task_params))
if task_url.startswith('http'):
- req = urllib.request.Request("{task_url}/{task_name}/params.json".format(**params))
- web_task_params = json.load(urllib.request.urlopen(req))
+ response = urllib.request.urlopen('{task_url}/{task_name}/params.json'.format(**params))
+ web_task_params = json.load(io.TextIOWrapper(response))
task_params.update(web_task_params)
params_argparser = argparse.ArgumentParser(parents=[argparser], conflict_handler='resolve', add_help=True)
params_argparser = add_meta_to_argparser(params_argparser, task_params_meta, defaults=task_params)