I'm migrating our scripts from python 2.7.14 to 3.6.3
I stuck on the Template.to_json()
I tried to create a list of dict_values with json.dumps but then I also needed to decode troposphere Importvalue
File "/home/X/x/git/x/x/eb.py", line 313, in get_json
return self.template.to_json()
File "/home/X/.local/lib/python3.6/site-packages/troposphere/__init__.py", line 624, in to_json
sort_keys=sort_keys, separators=separators)
File "/home/X/python3/lib/python3.6/json/__init__.py", line 238, in dumps
**kw).encode(obj)
File "/home/X/python3/lib/python3.6/json/encoder.py", line 201, in encode
chunks = list(chunks)
File "/home/X/python3/lib/python3.6/json/encoder.py", line 430, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/home/X/python3/lib/python3.6/json/encoder.py", line 404, in _iterencode_dict
yield from chunks
File "/home/X/python3/lib/python3.6/json/encoder.py", line 404, in _iterencode_dict
yield from chunks
File "/home/X/python3/lib/python3.6/json/encoder.py", line 404, in _iterencode_dict
yield from chunks
File "/home/X/python3/lib/python3.6/json/encoder.py", line 325, in _iterencode_list
yield from chunks
File "/home/X/python3/lib/python3.6/json/encoder.py", line 404, in _iterencode_dict
yield from chunks
File "/home/X/python3/lib/python3.6/json/encoder.py", line 404, in _iterencode_dict
yield from chunks
File "/home/X/python3/lib/python3.6/json/encoder.py", line 325, in _iterencode_list
yield from chunks
File "/home/X/python3/lib/python3.6/json/encoder.py", line 437, in _iterencode
o = _default(o)
File "/home/X/python3/lib/python3.6/json/encoder.py", line 180, in default
o.__class__.__name__)
TypeError: Object of type 'dict_values' is not JSON serializable
'DEBUG' o value:
o=dict_values([<troposphere.ImportValue object at 0x7fc7e9f83da0>, <troposphere.ImportValue object at 0x7fc7e9f83e80>, <troposphere.ImportValue object at 0x7fc7e9f83c88>])