gpilab / core-nodes

The core nodes are a collection of basic data manipulation and visualization algorithms.
http://docs.gpilab.com/en/develop/NodeDev/devguide.html
BSD 3-Clause "New" or "Revised" License
11 stars 6 forks source link

Unable to save network with GLViewer node #28

Open borupdaniel opened 4 years ago

borupdaniel commented 4 years ago

@nckz identified this on GitLab a while ago — I can confirm it is still an issue in GPI 1.1.6.

Here is the error message I get in a Python 3.8 environment:

Thu Jan 16 10:33:46 2020 - gpi.network:367 - ERROR - Saving network failed. Traceback (most recent call last):
  File "/Users/m206107/gpi_stack/envs/gpi38/lib/python3.8/site-packages/gpi/network.py", line 364, in save
    json.dump(self._contents, fptr, sort_keys=True, indent=1)
  File "/Users/m206107/gpi_stack/envs/gpi38/lib/python3.8/json/__init__.py", line 179, in dump
    for chunk in iterable:
  File "/Users/m206107/gpi_stack/envs/gpi38/lib/python3.8/json/encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/Users/m206107/gpi_stack/envs/gpi38/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/Users/m206107/gpi_stack/envs/gpi38/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/Users/m206107/gpi_stack/envs/gpi38/lib/python3.8/json/encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "/Users/m206107/gpi_stack/envs/gpi38/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/Users/m206107/gpi_stack/envs/gpi38/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/Users/m206107/gpi_stack/envs/gpi38/lib/python3.8/json/encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "/Users/m206107/gpi_stack/envs/gpi38/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/Users/m206107/gpi_stack/envs/gpi38/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/Users/m206107/gpi_stack/envs/gpi38/lib/python3.8/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/Users/m206107/gpi_stack/envs/gpi38/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type ndarray is not JSON serializable
borupdaniel commented 4 years ago

Actually, it will save a .net file, but GPI will crash when trying to load that file as a network.