Skip to content

Commit

Permalink
use our custom json serializer instead of json.dumps. natcap#1280.
Browse files Browse the repository at this point in the history
  • Loading branch information
davemfish committed Apr 21, 2023
1 parent 363fe5b commit 18bd5f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
Unreleased Changes
------------------
* General
* Fixed a bug in the CLI where ``invest getspec --json`` failed on
non-json-serializable objects such as ``pint.Unit``.
https://github.com/natcap/invest/issues/1280
* Workbench
* Fixed a bug where sampledata downloads failed silently (and progress bar
became innacurate) if the Workbench did not have write permission to
Expand Down
3 changes: 2 additions & 1 deletion src/natcap/invest/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from natcap.invest import datastack
from natcap.invest import model_metadata
from natcap.invest import set_locale
from natcap.invest import spec_utils
from natcap.invest import ui_server
from natcap.invest import utils

Expand Down Expand Up @@ -417,7 +418,7 @@ def main(user_args=None):
spec = model_module.MODEL_SPEC

if args.json:
message = json.dumps(spec)
message = spec_utils.serialize_args_spec(spec)
else:
message = pprint.pformat(spec)
sys.stdout.write(message)
Expand Down

0 comments on commit 18bd5f7

Please sign in to comment.