Skip to content

Commit 43a8e78

Browse files
implement fallback for dict plug values that can't be serialized
1 parent a8e885c commit 43a8e78

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

flowpipe_editor/widgets/properties_bin/attribute_widgets.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ def __init__(self, parent: QtWidgets, plug: IPlug):
2323
self.layout().setContentsMargins(0, 0, 0, 0)
2424
self.lineedit = QtWidgets.QLineEdit(self)
2525
if isinstance(self.plug.value, dict):
26-
self.lineedit.setText(json.dumps(self.plug.value))
26+
try:
27+
self.lineedit.setText(json.dumps(self.plug.value))
28+
except TypeError:
29+
# If the value cannot be serialized, fall back to str
30+
self.lineedit.setText(str(self.plug.value))
2731
else:
2832
self.lineedit.setText(str(self.plug.value))
2933
self.layout().addWidget(self.lineedit)

0 commit comments

Comments
 (0)