X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/blobdiff_plain/8604d34521be2576ccc887d7799d0373da412720..8724d12824dba6525d3f52d861c8cf3c4583f05e:/tasklib/task.py diff --git a/tasklib/task.py b/tasklib/task.py index c267048..9246e1f 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -252,7 +252,7 @@ class TaskWarrior(object): logger.debug(' '.join(command_args)) p = subprocess.Popen(command_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, stderr = p.communicate() + stdout, stderr = [x.decode() for x in p.communicate()] if p.returncode: if stderr.strip(): error_msg = stderr.strip().splitlines()[-1] @@ -266,7 +266,11 @@ class TaskWarrior(object): tasks = [] for line in self.execute_command(args): if line: - tasks.append(Task(self, json.loads(line.strip(',')))) + data = line.strip(',') + try: + tasks.append(Task(self, json.loads(data))) + except ValueError: + raise TaskWarriorException('Invalid JSON: %s' % data) return tasks def merge_with(self, path, push=False):