akernel
akernel copied to clipboard
Error when send_message is called without buffers
Hi @davidbrochart!
It turns out that akernel actually solves the issue with the widget we are building. We can use await
to call async methods on our widget and the akernel isn't blocked unlike the default one:
Do you think there is a chance of these changes being accepted into the default ipykernel?
Our widget calls self.send(msg)
without passing buffers
and we are hitting this error:
It works just fine if we use self.send(msg, buffers=[])
instead, but I think akernel should also handle buffers=None
.
Actually, send_message
in akernel has a mutable default list argument for buffers
which is problematic. It should probably just have a check if buffers to is not None
instead
Note the error is actually from here: https://github.com/jupyter-widgets/ipywidgets/blob/4132414e5a4615a78cc6b849824a6df0155b26e9/ipywidgets/widgets/widget.py#L516-L526
widgets.send
defaults buffers
to None
.
Hi @ilyabo!
Do you think there is a chance of these changes being accepted into the default ipykernel?
I don't know ipykernel enough to know if it would be possible, and how hard, but akernel is definitely a project where we can experiment with this kind of new behaviors. If it solves real problems, or offer useful new features, sure we can think of contributing to the official Python kernel. Actually I'm happy that you tried it out, because I knew it could solve issues such as the one you are mentioning.
Thanks a lot @kylebarron for opening a PR, I need to polish akernel as up to now I was just trying to have something working, and was not expecting someone to use it, but very glad it happened! I'll be off for the next 5 days so don't expect any answer until then.