From a644463bd47dc1d38f6ed6015be3cb4ad9211c77 Mon Sep 17 00:00:00 2001 From: Dave Moffat Date: Mon, 14 Sep 2020 12:49:05 +0100 Subject: [PATCH 1/3] parsing unicode characters in survey questions --- python/survey_parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 python/survey_parser.py diff --git a/python/survey_parser.py b/python/survey_parser.py old mode 100644 new mode 100755 index a64d684c..555e341d --- a/python/survey_parser.py +++ b/python/survey_parser.py @@ -70,8 +70,8 @@ def decodeSurveyStatement(session_id, survey_entry, store): return store def decodeSurveyQuestion(session_id, survey_entry, store): - if survey_entry.find("./response") is not None: - resp = (session_id, survey_entry.get("duration"), survey_entry.find("./response").text) + if survey_entry.find("./response") is not None and survey_entry.find("./response").text is not None: + resp = (session_id, survey_entry.get("duration"), survey_entry.find("./response").text.encode('utf-8')) else: resp = (session_id, survey_entry.get("duration"), None) store["responses"].append(resp) From 3a2a2c49541559db4682342b648834817cfdb237 Mon Sep 17 00:00:00 2001 From: Dave Moffat Date: Mon, 14 Sep 2020 12:49:39 +0100 Subject: [PATCH 2/3] forcing python 2.7 - as not python 3 compliant --- python/survey_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/survey_parser.py b/python/survey_parser.py index 555e341d..9bb28ffb 100755 --- a/python/survey_parser.py +++ b/python/survey_parser.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2.7 import xml.etree.ElementTree as ET import os import sys From 92177500ba3c9bb28b599be456430b5e69a8b382 Mon Sep 17 00:00:00 2001 From: Dave Moffat Date: Mon, 14 Sep 2020 12:55:12 +0100 Subject: [PATCH 3/3] explicitly stating requirement for python 2 --- python/score_parser.py | 2 +- python/score_plot.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 python/score_parser.py mode change 100644 => 100755 python/score_plot.py diff --git a/python/score_parser.py b/python/score_parser.py old mode 100644 new mode 100755 index c5d27288..481bc3ed --- a/python/score_parser.py +++ b/python/score_parser.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2.7 import xml.etree.ElementTree as ET import os diff --git a/python/score_plot.py b/python/score_plot.py old mode 100644 new mode 100755 index c8cede79..84435ac6 --- a/python/score_plot.py +++ b/python/score_plot.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2.7 import sys import os