Skip to content

Commit 1bb7cef

Browse files
committed
2.7 portability
1 parent ec57687 commit 1bb7cef

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/jsonparse/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def _parse_input(args):
8686
# type: (argparse.ArgumentParser) -> None
8787
try:
8888
data = _pythonify(_input(args.file))
89-
except json.decoder.JSONDecodeError:
89+
except ValueError:
9090
print('input json not valid.')
9191
raise SystemExit(0)
9292

@@ -99,14 +99,14 @@ def _parse_input(args):
9999
elif ('KVKEY' in args) and ('KVVALUE' in args):
100100
try:
101101
value = _pythonify(args.KVVALUE[0])
102-
except json.decoder.JSONDecodeError:
102+
except ValueError:
103103
print('value is not valid json. example valid types: \'"value"\', 5, false, true, null')
104104
raise SystemExit(0)
105105
_print(_jsonify(Parser().find_key_value(data, args.KVKEY[0], value)))
106106
elif 'VALUE' in args:
107107
try:
108108
value = _pythonify(args.VALUE[0])
109-
except json.decoder.JSONDecodeError:
109+
except ValueError:
110110
print('value is not valid json. example valid types: \'"value"\', 5, false, true, null')
111111
raise SystemExit(0)
112112
_print(_jsonify(Parser().find_value(data, value)))

0 commit comments

Comments
 (0)