Skip to content

NodeGraph.save_session cannot serialize sets #356

@snorthman

Description

@snorthman

NodeGraph.save_session(str) does not work, as it cannot serialize set objects.

Here is where a set occurs in my serialized session:

unserializable: set = serialized['graph']['accept_connection_types']['simulator.SimulatorNode']['in']['sim']['simulator.SimulationNode']['out']

Two easy solutions, rather than avoid sets in serialization:

stackoverflow SetEncoder

or

def serialize_json(obj):
  if isinstance(obj, set):
    return list(obj)
  return obj

json.dumps(text, default=self.serialize_json)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions