pacti-org / pacti

A package for compositional system analysis and design
https://www.pacti.org
BSD 3-Clause "New" or "Revised" License
19 stars 5 forks source link

writeContract raising exceptions #108

Closed pierg closed 1 year ago

pierg commented 1 year ago

Traceback (most recent call last): File "/Users/pier/Projects/gear/case_studies/topologies/grammar/contracts.py", line 43, in refines_io_contract writeContract(c, f"C_exc_lhs") File "/Users/pier/Projects/gear/src/pacti/terms/polyhedra/loaders.py", line 80, in writeContract json.dump(c_dict, f) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 179, in dump for chunk in iterable: File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 432, in _iterencode yield from _iterencode_dict(o, _current_indent_level) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 406, in _iterencode_dict yield from chunks File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 326, in _iterencode_list yield from chunks File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 406, in _iterencode_dict yield from chunks File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 439, in _iterencode o = _default(o) ^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 180, in default raise TypeError(f'Object of type {o.class.name} ' TypeError: Object of type Integer is not JSON serializable

To reproduce: branch: pier run: case_study/topologies/main.py

Exception caused by line 41 in case_study/topologies/grammar/contract.py

ayush9pandey commented 1 year ago

I found this issue earlier and fixed it in synbio branch. I will push the changes later today.

pierg commented 1 year ago

Ok, thanks!