You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(C:\Users\dmf\projects\invest\env) λ invest getspec --json pollination
Traceback (most recent call last):
File "C:\Users\dmf\projects\invest\env\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\dmf\projects\invest\env\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\dmf\projects\invest\env\Scripts\invest.exe\__main__.py", line 7, in <module>
File "C:\Users\dmf\projects\invest\env\lib\site-packages\natcap\invest\cli.py", line 420, in main
message = json.dumps(spec)
File "C:\Users\dmf\projects\invest\env\lib\json\__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "C:\Users\dmf\projects\invest\env\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Users\dmf\projects\invest\env\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "C:\Users\dmf\projects\invest\env\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Unit is not JSON serializable
We actually have a test for this in test_model_specs.py and a special serializer in spec_utils.serialize_args_spec to format pint.Unit objects. So the problem is likely just that the CLI is not using our serializer, but just trying json.dumps instead.
The text was updated successfully, but these errors were encountered:
We actually have a test for this in
test_model_specs.py
and a special serializer inspec_utils.serialize_args_spec
to formatpint.Unit
objects. So the problem is likely just that the CLI is not using our serializer, but just tryingjson.dumps
instead.The text was updated successfully, but these errors were encountered: