Skip to content

Commit

Permalink
2.7 portability
Browse files Browse the repository at this point in the history
  • Loading branch information
ctomkow committed Aug 8, 2024
1 parent ec57687 commit 1bb7cef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/jsonparse/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _parse_input(args):
# type: (argparse.ArgumentParser) -> None
try:
data = _pythonify(_input(args.file))
except json.decoder.JSONDecodeError:
except ValueError:
print('input json not valid.')
raise SystemExit(0)

Expand All @@ -99,14 +99,14 @@ def _parse_input(args):
elif ('KVKEY' in args) and ('KVVALUE' in args):
try:
value = _pythonify(args.KVVALUE[0])
except json.decoder.JSONDecodeError:
except ValueError:
print('value is not valid json. example valid types: \'"value"\', 5, false, true, null')
raise SystemExit(0)
_print(_jsonify(Parser().find_key_value(data, args.KVKEY[0], value)))
elif 'VALUE' in args:
try:
value = _pythonify(args.VALUE[0])
except json.decoder.JSONDecodeError:
except ValueError:
print('value is not valid json. example valid types: \'"value"\', 5, false, true, null')
raise SystemExit(0)
_print(_jsonify(Parser().find_value(data, value)))
Expand Down

0 comments on commit 1bb7cef

Please sign in to comment.