Closed st-pasha closed 5 years ago
After digging around, the error has disappeared when I upgraded ipykernel
from 4.5.2
to the latest 5.1.0
version. Or, rather, it was replaced with a different error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-1-7e0ca782c360> in <module>
12 return button(str(count), onClick=on_click, style={'width': 100, 'height': 40})
13
---> 14 my_display = display(counter(), display_id=True)
15
16 my_display;
~/py36/lib/python3.6/site-packages/IPython/core/display.py in display(include, exclude, metadata, transient, display_id, *objs, **kwargs)
303 # kwarg-specified metadata gets precedence
304 _merge(md_dict, metadata)
--> 305 publish_display_data(data=format_dict, metadata=md_dict, **kwargs)
306 if display_id:
307 return DisplayHandle(display_id)
~/py36/lib/python3.6/site-packages/IPython/core/display.py in publish_display_data(data, metadata, source, transient, **kwargs)
118 data=data,
119 metadata=metadata,
--> 120 **kwargs
121 )
122
~/py36/lib/python3.6/site-packages/ipykernel/zmqshell.py in publish(self, data, metadata, source, transient, update)
127 # hooks before potentially sending.
128 msg = self.session.msg(
--> 129 msg_type, json_clean(content),
130 parent=self.parent_header
131 )
~/py36/lib/python3.6/site-packages/ipykernel/jsonutil.py in json_clean(obj)
189 out = {}
190 for k,v in iteritems(obj):
--> 191 out[unicode_type(k)] = json_clean(v)
192 return out
193 if isinstance(obj, datetime):
~/py36/lib/python3.6/site-packages/ipykernel/jsonutil.py in json_clean(obj)
189 out = {}
190 for k,v in iteritems(obj):
--> 191 out[unicode_type(k)] = json_clean(v)
192 return out
193 if isinstance(obj, datetime):
~/py36/lib/python3.6/site-packages/ipykernel/jsonutil.py in json_clean(obj)
189 out = {}
190 for k,v in iteritems(obj):
--> 191 out[unicode_type(k)] = json_clean(v)
192 return out
193 if isinstance(obj, datetime):
~/py36/lib/python3.6/site-packages/ipykernel/jsonutil.py in json_clean(obj)
189 out = {}
190 for k,v in iteritems(obj):
--> 191 out[unicode_type(k)] = json_clean(v)
192 return out
193 if isinstance(obj, datetime):
~/py36/lib/python3.6/site-packages/ipykernel/jsonutil.py in json_clean(obj)
195
196 # we don't understand it, it's probably an unserializable object
--> 197 raise ValueError("Can't clean for JSON: %r" % obj)
ValueError: Can't clean for JSON: <function on_click at 0x11010b9d8>
It seems the encode_attributes
function in core.py
is supposed to handle callback methods, yet it is not called from anywhere.
cc @gnestor š
@st-pasha Sorry the front-end side hasn't been implemented yet. There is an open PR on jupyter-renderers (https://github.com/jupyterlab/jupyter-renderers/pull/134) that did implement this in JupyterLab, but this stuff needs to be moved into @nteract/transform-vdom and the kernel-related parts in @jupyterlab/vdom-extension.
Is there any progress on this? It would be really great to have that functionality. Thanks.
Just waiting for https://github.com/jupyterlab/jupyterlab/pull/5670 to be merged in jupyterlab
It was merged a while back, closing now...
When running this code in a JupyterLab notebook
the following error occurs:
My environment is:
vdom-0.5
IPython-7.0.1
jupyterlab-0.35.0