From 33d280bd59fc29be4e077964cbb54d0fd7c9eb24 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Sat, 12 Dec 2020 17:02:25 +0100 Subject: Fix json read if input is not a stream --- patternutils/commands/pjson.py | 2 +- patternutils/commands/targs.py | 2 +- patternutils/commands/tln.py | 2 +- patternutils/commands/tmv.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/patternutils/commands/pjson.py b/patternutils/commands/pjson.py index d114d4c..a7bf069 100644 --- a/patternutils/commands/pjson.py +++ b/patternutils/commands/pjson.py @@ -83,7 +83,7 @@ def pjson( if stream: data = map(utils.json_loads, read_from) # type: ignore else: - data = utils.json_loads(read_from) + data = utils.json_loads(read_from.read()) matches = [] diff --git a/patternutils/commands/targs.py b/patternutils/commands/targs.py index 5c5a063..ae8b74d 100644 --- a/patternutils/commands/targs.py +++ b/patternutils/commands/targs.py @@ -83,7 +83,7 @@ def targs( if stream: data = map(utils.json_loads, read_from) else: - data = utils.json_loads(read_from) + data = utils.json_loads(read_from.read()) if use_predefined_template: try: diff --git a/patternutils/commands/tln.py b/patternutils/commands/tln.py index 0dec44b..509f4ad 100644 --- a/patternutils/commands/tln.py +++ b/patternutils/commands/tln.py @@ -104,7 +104,7 @@ def tln( if stream: data = map(utils.json_loads, read_from) else: - data = utils.json_loads(read_from) + data = utils.json_loads(read_from.read()) if use_predefined_template: try: diff --git a/patternutils/commands/tmv.py b/patternutils/commands/tmv.py index 1f39cc0..5ae2582 100644 --- a/patternutils/commands/tmv.py +++ b/patternutils/commands/tmv.py @@ -102,7 +102,7 @@ def tmv( if stream: data = map(utils.json_loads, read_from) else: - data = utils.json_loads(read_from) + data = utils.json_loads(read_from.read()) if use_predefined_template: try: -- cgit v1.3.1