Open MarcSkovMadsen opened 2 years ago
This may be the same issue as https://github.com/bokeh/ipywidgets_bokeh/issues/42 since VegaFusion also uses binary messages
Bokeh 3.0 will have much better support for binary messages so we may just get this for free.
@mattpap What do you think? Will your new serialization work allow serializing an ArrayBuffer embedded in some JSON object?
It does have bidirectional support for bytes <-> ArrayBuffer
serialization.
I just stumbled on this repo today, because I was working on a reboot of flask_ipywidgets and was curious how you people were doing some similar work (the code looks very similar 👀 ). My guess is that https://github.com/bokeh/ipywidgets_bokeh/blob/main/ipywidgets_bokeh/kernel.py#L71 has an issue when there is a memoryview object with a non-byte format. A .cast('b')
or using . nbytes
should work better instead of the len(..)
, not sure if that fixes this bug, but certainly an issue, and it which might fix #42 as well.
Thanks @maartenbreddels . I dont know the details by @philippjfr has said the next version of Bokeh will solve this issue.
Wanted to update this issue with the current behavior using the latest versions of the various libraries:
Versions:
ipywidgets-bokeh 1.4.0
panel 1.0.4
vegafusion-jupyter 1.3.0
vega-datasets 0.9.0
Example app: try_panel.py
import panel as pn
import ipywidgets as ipw
pn.extension('ipywidgets')
from vega_datasets import data
import altair as alt
import vegafusion as vf
source = alt.UrlData(
data.flights_2k.url,
format={'parse': {'date': 'date'}}
)
brush = alt.selection_interval(encodings=['x'])
# Define the base chart, with the common parts of the
# background and highlights
base = alt.Chart(width=160, height=130).mark_bar().encode(
x=alt.X(alt.repeat('column')).bin(maxbins=20),
y='count()'
)
# gray background with selection
background = base.encode(
color=alt.value('#ddd')
).add_params(brush)
# blue highlights on the transformed data
highlight = base.transform_filter(brush)
# layer the two charts & repeat
chart = alt.layer(
background,
highlight,
data=source
).transform_calculate(
"time",
"hours(datum.date)"
).repeat(column=["distance", "delay", "time"])
chart_widget = vf.jupyter.VegaFusionWidget(chart)
pn.panel(chart_widget).servable()
Run app:
panel serve try_panel.py --show
The window opens and the widgets loads successfully (as indicated by the VegaFusion logo being displayed). But an error occurs immediately after:
Browser trace:
[bokeh] Unhandled ERROR reply to 6D70744E946F4A24A7200D18588EFA20: UnicodeDecodeError('utf-32-be', b'\x00\x00\x00\x02\x00\x00\x00\x0c\x00\x00\x01\x83{"channel":"shell","content":{"comm_id":"7dcba7218edf4c34ae3228206ef4a839","data":{"method":"update","state":{},"buffer_paths":[["_request_msg"]]}},"header":{"date":"2023-06-04T21:48:12.772Z","msg_id":"c5cb3657-d9dd-4c9b-97f9-7f83e50b71da","msg_type":"comm_msg","session":"2f30d42e-36da-4ee6-af58-9ae46e2aa591","username":"","version":"5.2"},"metadata":{},"parent_header":{}}\n\xdc)\n\xaf)\n\xca\x01\n\xa6\x01\n\x0c\n\x08source_0\x10\x01*\x81\x01\nGhttps://cdn.jsdelivr.net/npm/vega-datasets@v1.29.0/data/flights-2k.json\x18\xa0?"\x16\n\x04json\x1a\x0e\n\x0c\n\x04date\x12\x04date*\x1b\n\x19R\x17\n\x04date\n\x05delay\n\x08distanceB\x12\n\x10America/New_York\x1a\x04\x08\x01\x10\x01\x1a\x04\x08\x03\x10\x01 \xd2\xc2\xa0\xcf\xf3\x94\x8a\xb7\xc6\x01(\x96\xec\x98\x8b\xcd\x91\xa2\x87\x14\n\xfb\x03\n\xd4\x03\n\n\n\x06data_6\x10\x012\xb1\x03\n\x08source_0\x12\xa4\x03\nD\x1aB\n::2\n\x05hours\x12)R!\n\x0f\n\x07\n\x05datumZ\x04\x08\x06\x10\x0b\x12\x0e\n\x06\n\x04dateZ\x04\x08\x0c\x10\x10Z\x04\x08\x0b\x10\x10Z\x04\x08\x05\x10\x11\x12\x04time\n?\x12=\n\x04time\x125child__column_time_layer_1_bin_maxbins_20_time_extent\n\xd1\x01"\xce\x01\n\x04time\x12=\n7\n5child__column_time_layer_1_bin_maxbins_20_time_extentZ\x02\x105\x1a3child__column_time_layer_1_bin_maxbins_20_time_bins"\x13bin_maxbins_20_time*\x17bin_maxbins_20_time_end9\x00\x00\x00\x00\x00\x004@A\x00\x00\x00\x00\x00\x00$@j\x10\x00\x00\x00\x00\x00\x00\x14@\x00\x00\x00\x00\x00\x00\x00@p\x01\nGRE\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_end\n\x05delay\n\x08distance\n\x04timeB\x12\n\x10America/New_York\x12\x00\x1a\x04\x08\n\x10\x01\x1a\x04\x08\x02\x10\x01 \x8f\xb0\x90\x91\xb5\xa8\xdd\xd2\xa3\x01(\xcf\xee\xee\x9d\xed\xa6\xa0\x8a\xfe\x01\n\xb2\x03\n\x96\x03\n\n\n\x06data_8\x10\x012\xf3\x02\n\x06data_6\x12\xe8\x02\n>*<\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_end\x12\x00\x1a\x07__count"\x01\x00\n\xea\x01\n\xe7\x01\n\xe4\x01"\xdb\x01\nd:\\\n\x07isValid\x12QRI\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x124\x12,\n\x15"bin_maxbins_20_time"\x12\x13bin_maxbins_20_timeZ\x04\x08\x0e\x10#\x18\x01Z\x04\x08\r\x10$Z\x04\x08\x07\x10%\x10\x01\x1aq:i\n\x08isFinite\x12]*U\x10\x01\x1aQRI\n\x0f\n\x07\n\x05datumZ\x04\x083\x108\x124\x12,\n\x15"bin_maxbins_20_time"\x12\x13bin_maxbins_20_timeZ\x04\x089\x10N\x18\x01Z\x04\x088\x10OZ\x04\x082\x10OZ\x04\x081\x10PZ\x04\x08&\x10P\n9R7\n\x07__count\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_endB\x12\n\x10America/New_York\x12\x02\x08\x01 \xcf\x96\x81\xc7\xeb\xe1\xb3\xfe\xaa\x01(\xae\xd5\x85\xf0\xdd\xf6\xf1\xde+\n\xfe\x06\n\xd3\x06\n\n\n\x06data_0\x10\x012\xb0\x06\n\x08source_0\x12\xa3\x06\nB\x12@\n\x05delay\x127child__column_delay_layer_1_bin_maxbins_20_delay_extent\n\xd8\x01"\xd5\x01\n\x05delay\x12?
...
Python trace
2023-06-04 17:48:12,777 error handling message
message: Message 'PATCH-DOC' content: {'events': [{'kind': 'MessageSent', 'msg_type': 'ipywidgets_bokeh', 'msg_data': {'type': 'bytes', 'data': {'id': '0'}}}]}
error: UnicodeDecodeError('utf-32-be', b'\x00\x00\x00\x02\x00\x00\x00\x0c\x00\x00\x01\x83{"channel":"shell","content":{"comm_id":"7dcba7218edf4c34ae3228206ef4a839","data":{"method":"update","state":{},"buffer_paths":[["_request_msg"]]}},"header":{"date":"2023-06-04T21:48:12.772Z","msg_id":"c5cb3657-d9dd-4c9b-97f9-7f83e50b71da","msg_type":"comm_msg","session":"2f30d42e-36da-4ee6-af58-9ae46e2aa591","username":"","version":"5.2"},"metadata":{},"parent_header":{}}\n\xdc)\n\xaf)\n\xca\x01\n\xa6\x01\n\x0c\n\x08source_0\x10\x01*\x81\x01\nGhttps://cdn.jsdelivr.net/npm/vega-datasets@v1.29.0/data/flights-2k.json\x18\xa0?"\x16\n\x04json\x1a\x0e\n\x0c\n\x04date\x12\x04date*\x1b\n\x19R\x17\n\x04date\n\x05delay\n\x08distanceB\x12\n\x10America/New_York\x1a\x04\x08\x01\x10\x01\x1a\x04\x08\x03\x10\x01 \xd2\xc2\xa0\xcf\xf3\x94\x8a\xb7\xc6\x01(\x96\xec\x98\x8b\xcd\x91\xa2\x87\x14\n\xfb\x03\n\xd4\x03\n\n\n\x06data_6\x10\x012\xb1\x03\n\x08source_0\x12\xa4\x03\nD\x1aB\n::2\n\x05hours\x12)R!\n\x0f\n\x07\n\x05datumZ\x04\x08\x06\x10\x0b\x12\x0e\n\x06\n\x04dateZ\x04\x08\x0c\x10\x10Z\x04\x08\x0b\x10\x10Z\x04\x08\x05\x10\x11\x12\x04time\n?\x12=\n\x04time\x125child__column_time_layer_1_bin_maxbins_20_time_extent\n\xd1\x01"\xce\x01\n\x04time\x12=\n7\n5child__column_time_layer_1_bin_maxbins_20_time_extentZ\x02\x105\x1a3child__column_time_layer_1_bin_maxbins_20_time_bins"\x13bin_maxbins_20_time*\x17bin_maxbins_20_time_end9\x00\x00\x00\x00\x00\x004@A\x00\x00\x00\x00\x00\x00$@j\x10\x00\x00\x00\x00\x00\x00\x14@\x00\x00\x00\x00\x00\x00\x00@p\x01\nGRE\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_end\n\x05delay\n\x08distance\n\x04timeB\x12\n\x10America/New_York\x12\x00\x1a\x04\x08\n\x10\x01\x1a\x04\x08\x02\x10\x01 \x8f\xb0\x90\x91\xb5\xa8\xdd\xd2\xa3\x01(\xcf\xee\xee\x9d\xed\xa6\xa0\x8a\xfe\x01\n\xb2\x03\n\x96\x03\n\n\n\x06data_8\x10\x012\xf3\x02\n\x06data_6\x12\xe8\x02\n>*<\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_end\x12\x00\x1a\x07__count"\x01\x00\n\xea\x01\n\xe7\x01\n\xe4\x01"\xdb\x01\nd:\\\n\x07isValid\x12QRI\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x124\x12,\n\x15"bin_maxbins_20_time"\x12\x13bin_maxbins_20_timeZ\x04\x08\x0e\x10#\x18\x01Z\x04\x08\r\x10$Z\x04\x08\x07\x10%\x10\x01\x1aq:i\n\x08isFinite\x12]*U\x10\x01\x1aQRI\n\x0f\n\x07\n\x05datumZ\x04\x083\x108\x124\x12,\n\x15"bin_maxbins_20_time"\x12\x13bin_maxbins_20_timeZ\x04\x089\x10N\x18\x01Z\x04\x088\x10OZ\x04\x082\x10OZ\x04\x081\x10PZ\x04\x08&\x10P\n9R7\n\x07__count\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_endB\x12\n\x10America/New_York\x12\x02\x08\x01 \xcf\x96\x81\xc7\xeb\xe1\xb3\xfe\xaa\x01(\xae\xd5\x85\xf0\xdd\xf6\xf1\xde+\n\xfe\x06\n\xd3\x06\n\n\n\x06data_0\x10\x012\xb0\x06\n\x08source_0\x12\xa3\x06\nB\x12@\n\x05delay\x127child__column_delay_layer_1_bin_maxbins_20_delay_extent\n\xd8\x01"\xd5\x01\n\x05delay\x12?\n9\n7child__column_delay_layer_1_bin_maxbins_20_delay_extentZ\x02\x107\x1a5child__column_delay_layer_1_bin_maxbins_20_delay_bins"\x14bin_maxbins_20_delay*\x18bin_maxbins_20_delay_end9\x00\x00\x00\x00\x00\x004@A\x00\x00\x00\x00\x00\x00$@j\x10\x00\x00\x00\x00\x00\x00\x14@\x00\x00\x00\x00\x00\x00\x00@p\x01\nK\x12I\n\x08distance\x12=child__column_distance_layer_1_bin_maxbins_20_distance_extent\n\xed\x01"\xea\x01\n\x08distance\x12E\n?\n=child__column_distance_layer_1_bin_maxbins_20_distance_extentZ\x02\x10=\x1a;child__column_distance_layer_1_bin_maxbins_20_distance_bins"\x17bin_maxbins_20_distance*\x1bbin_maxbins_20_distance_end9\x00\x00\x00\x00\x00\x004@A\x00\x00\x00\x00\x00\x00$@j\x10\x00\x00\x00\x00\x00\x00\x14@\x00\x00\x00\x00\x00\x00\x00@p\x01\nD\x1aB\n::2\n\x05hours\x12)R!\n\x0f\n\x07\n\x05datumZ\x04\x08\x06\x10\x0b\x12\x0e\n\x06\n\x04dateZ\x04\x08\x0c\x10\x10Z\x04\x08\x0b\x10\x10Z\x04\x08\x05\x10\x11\x12\x04time\n\x7fR}\n\x14bin_maxbins_20_delay\n\x18bin_maxbins_20_delay_end\n\x17bin_maxbins_20_distance\n\x1bbin_maxbins_20_distance_end\n\x05delay\n\x08distance\n\x04timeB\x12\n\x10America/New_York\x12\x00\x1a\x04\x08\x07\x10\x01\x1a\x04\x08\x04\x10\x01\x1a\x04\x08\x05\x10\x01 \xc6\xfb\x8f\x85\xc7\xe9\xea\xe0 (\xf9\x8b\xa8\x93\xff\xb2\xf3\xb25\n\xd3\x03\n\xb6\x03\n\n\n\x06data_5\x10\x012\x93\x03\n\x06data_0\x12\x88\x03\nF*D\n\x17bin_maxbins_20_distance\n\x1bbin_maxbins_20_distance_end\x12\x00\x1a\x07__count"\x01\x00\n\xfa\x01\n\xf7\x01\n\xf4\x01"\xeb\x01\nl:d\n\x07isValid\x12YRQ\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x12<\x124\n\x19"bin_maxbins_20_distance"\x12\x17bin_maxbins_20_distanceZ\x04\x08\x0e\x10\'\x18\x01Z\x04\x08\r\x10(Z\x04\x08\x07\x10)\x10\x01\x1ay:q\n\x08isFinite\x12e*]\x10\x01\x1aYRQ\n\x0f\n\x07\n\x05datumZ\x04\x087\x10<\x12<\x124\n\x19"bin_maxbins_20_distance"\x12\x17bin_maxbins_20_distanceZ\x04\x08=\x10V\x18\x01Z\x04\x08<\x10WZ\x04\x086\x10WZ\x04\x085\x10XZ\x04\x08*\x10X\nAR?\n\x07__count\n\x17bin_maxbins_20_distance\n\x1bbin_maxbins_20_distance_endB\x12\n\x10America/New_York\x12\x02\x08\x03 \xe1\xe7\x8b\x8c\x9e\xb4\xb3\xf7\xda\x01(\x8b\xb2\xc5\xea\x93\xfb\xab\xeb\xfb\x01\n\xba\x03\n\x9e\x03\n\n\n\x06data_4\x10\x012\xfb\x02\n\x06data_0\x12\xf0\x02\n@*>\n\x14bin_maxbins_20_delay\n\x18bin_maxbins_20_delay_end\x12\x00\x1a\x07__count"\x01\x00\n\xee\x01\n\xeb\x01\n\xe8\x01"\xdf\x01\nf:^\n\x07isValid\x12SRK\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x126\x12.\n\x16"bin_maxbins_20_delay"\x12\x14bin_maxbins_20_delayZ\x04\x08\x0e\x10$\x18\x01Z\x04\x08\r\x10%Z\x04\x08\x07\x10&\x10\x01\x1as:k\n\x08isFinite\x12_*W\x10\x01\x1aSRK\n\x0f\n\x07\n\x05datumZ\x04\x084\x109\x126\x12.\n\x16"bin_maxbins_20_delay"\x12\x14bin_maxbins_20_delayZ\x04\x08:\x10P\x18\x01Z\x04\x089\x10QZ\x04\x083\x10QZ\x04\x082\x10RZ\x04\x08\'\x10R\n;R9\n\x07__count\n\x14bin_maxbins_20_delay\n\x18bin_maxbins_20_delay_endB\x12\n\x10America/New_York\x12\x02\x08\x03 \x92\x80\xc2\x88\xe4\xbf\xa0\xf9\x83\x01(\x81\x98\xee\xce\xde\xc7\x91\xf64\n\x85\x03\n\xe1\x02\n\x11\n\rparam_1_store\x10\x01\x1a\xcb\x02\x12\xc8\x02\xff\xff\xff\xff\xb8\x00\x00\x00\x10\x00\x00\x00\x00\x00\n\x00\x0c\x00\n\x00\t\x00\x04\x00\n\x00\x00\x00\x10\x00\x00\x00\x00\x01\x04\x00\x08\x00\x08\x00\x00\x00\x04\x00\x08\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x00\x14\x00\x00\x00\x10\x00\x16\x00\x10\x00\x0e\x00\x0f\x00\x04\x00\x00\x00\x08\x00\x10\x00\x00\x00\x18\x00\x00\x00\x1c\x00\x00\x00\x00\x00\x01\x02\x18\x00\x00\x00\x00\x00\x06\x00\x08\x00\x04\x00\x06\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00_vf_order\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xffx\x00\x00\x00\x10\x00\x00\x00\x00\x00\n\x00\x0e\x00\x0c\x00\x0b\x00\x04\x00\n\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x03\x04\x00\n\x00\x0c\x00\x00\x00\x08\x00\x04\x00\n\x00\x00\x00\x1c\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00\x1a\x04\x08\x07\x10\x01\x1a\x04\x08\n\x10\x01 \x80\xf6\xe3\xa5\xd3\xe5\xf5\xec\xb7\x01(\x9c\xe2\xed\x88\xb3\xfc\x85\xc1\x10\n\x84\x03\n\xd8\x02\n\n\n\x06data_1\x10\x012\xb5\x02\n\x06data_0\x12\xaa\x02\n\xbd\x01\n\xba\x01\n\xb7\x01"\xae\x01\nV*P\x08\x02\x10\x01\x1aJ:B\n\x06length\x128:0\n\x04data\x12(\x12 \n\x0f"param_1_store"\x12\rparam_1_storeZ\x04\x08\r\x10\x1cZ\x04\x08\x0c\x10\x1dZ\x04\x08\x07\x10\x1eZ\x02\x10\x1e\x1aT:L\n\x0fvlSelectionTest\x12(\x12 \n\x0f"param_1_store"\x12\rparam_1_storeZ\x04\x082\x10A\x12\x0f\n\x07\n\x05datumZ\x04\x08C\x10HZ\x04\x081\x10IZ\x04\x08\x1f\x10I\nhRf\n\x14bin_maxbins_20_delay\n\x18bin_maxbins_20_delay_end\n\x17bin_maxbins_20_distance\n\x1bbin_maxbins_20_distance_endB\x12\n\x10America/New_York\x12\x02\x08\x03\x12\x02\x08\x06\x1a\x04\x08\x08\x10\x01\x1a\x04\x08\t\x10\x01 \xef\xdd\x91\xc4\xc7\xe7\xf1\xda\x97\x01(\xf1\x99\x9e\xc9\x8e\xd8\x8b\xcb#\n\xba\x03\n\x9e\x03\n\n\n\x06data_2\x10\x012\xfb\x02\n\x06data_1\x12\xf0\x02\n@*>\n\x14bin_maxbins_20_delay\n\x18bin_maxbins_20_delay_end\x12\x00\x1a\x07__count"\x01\x00\n\xee\x01\n\xeb\x01\n\xe8\x01"\xdf\x01\nf:^\n\x07isValid\x12SRK\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x126\x12.\n\x16"bin_maxbins_20_delay"\x12\x14bin_maxbins_20_delayZ\x04\x08\x0e\x10$\x18\x01Z\x04\x08\r\x10%Z\x04\x08\x07\x10&\x10\x01\x1as:k\n\x08isFinite\x12_*W\x10\x01\x1aSRK\n\x0f\n\x07\n\x05datumZ\x04\x084\x109\x126\x12.\n\x16"bin_maxbins_20_delay"\x12\x14bin_maxbins_20_delayZ\x04\x08:\x10P\x18\x01Z\x04\x089\x10QZ\x04\x083\x10QZ\x04\x082\x10RZ\x04\x08\'\x10R\n;R9\n\x07__count\n\x14bin_maxbins_20_delay\n\x18bin_maxbins_20_delay_endB\x12\n\x10America/New_York\x12\x02\x08\x07 \xa0\x82\xb3\xf1\xab\x8e\x82\xda\xcb\x01(\x90\xc2\x83\xbd\xf8\xd6\xaa\xb2\x17\n\xd3\x03\n\xb6\x03\n\n\n\x06data_3\x10\x012\x93\x03\n\x06data_1\x12\x88\x03\nF*D\n\x17bin_maxbins_20_distance\n\x1bbin_maxbins_20_distance_end\x12\x00\x1a\x07__count"\x01\x00\n\xfa\x01\n\xf7\x01\n\xf4\x01"\xeb\x01\nl:d\n\x07isValid\x12YRQ\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x12<\x124\n\x19"bin_maxbins_20_distance"\x12\x17bin_maxbins_20_distanceZ\x04\x08\x0e\x10\'\x18\x01Z\x04\x08\r\x10(Z\x04\x08\x07\x10)\x10\x01\x1ay:q\n\x08isFinite\x12e*]\x10\x01\x1aYRQ\n\x0f\n\x07\n\x05datumZ\x04\x087\x10<\x12<\x124\n\x19"bin_maxbins_20_distance"\x12\x17bin_maxbins_20_distanceZ\x04\x08=\x10V\x18\x01Z\x04\x08<\x10WZ\x04\x086\x10WZ\x04\x085\x10XZ\x04\x08*\x10X\nAR?\n\x07__count\n\x17bin_maxbins_20_distance\n\x1bbin_maxbins_20_distance_endB\x12\n\x10America/New_York\x12\x02\x08\x07 \xa5\xc6\xbc\xb8\x9c\xd4\xaa\xfb\x8d\x01(\xcc\xab\xb2\x94\xed\xe4\xea\x87\xb6\x01\n\xf6\x04\n\xd6\x04\n\n\n\x06data_7\x10\x012\xb3\x04\n\x06data_6\x12\xa8\x04\n\xbd\x01\n\xba\x01\n\xb7\x01"\xae\x01\nV*P\x08\x02\x10\x01\x1aJ:B\n\x06length\x128:0\n\x04data\x12(\x12 \n\x0f"param_1_store"\x12\rparam_1_storeZ\x04\x08\r\x10\x1cZ\x04\x08\x0c\x10\x1dZ\x04\x08\x07\x10\x1eZ\x02\x10\x1e\x1aT:L\n\x0fvlSelectionTest\x12(\x12 \n\x0f"param_1_store"\x12\rparam_1_storeZ\x04\x082\x10A\x12\x0f\n\x07\n\x05datumZ\x04\x08C\x10HZ\x04\x081\x10IZ\x04\x08\x1f\x10I\n>*<\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_end\x12\x00\x1a\x07__count"\x01\x00\n\xea\x01\n\xe7\x01\n\xe4\x01"\xdb\x01\nd:\\\n\x07isValid\x12QRI\n\x0f\n\x07\n\x05datumZ\x04\x08\x08\x10\r\x124\x12,\n\x15"bin_maxbins_20_time"\x12\x13bin_maxbins_20_timeZ\x04\x08\x0e\x10#\x18\x01Z\x04\x08\r\x10$Z\x04\x08\x07\x10%\x10\x01\x1aq:i\n\x08isFinite\x12]*U\x10\x01\x1aQRI\n\x0f\n\x07\n\x05datumZ\x04\x083\x108\x124\x12,\n\x15"bin_maxbins_20_time"\x12\x13bin_maxbins_20_timeZ\x04\x089\x10N\x18\x01Z\x04\x088\x10OZ\x04\x082\x10OZ\x04\x081\x10PZ\x04\x08&\x10P\n9R7\n\x07__count\n\x13bin_maxbins_20_time\n\x17bin_maxbins_20_time_endB\x12\n\x10America/New_York\x12\x02\x08\x01\x12\x02\x08\x06 \xba\xb1\xed\x88\xff\xc8\xff\xe7$(\xb9\xea\x92\xcd\xe2\xda\xe3\xed\xf1\x01\x12\x02\x08\n\x12\x02\x08\x02\x12\x02\x08\x04\x12\x02\x08\x05\x12\x04\x08\x03\x10\x02\x12\x04\x08\x01\x10\x00\x12\x04\x08\x03\x10\x00\x12\x02\x08\t\x12\x02\x08\x08', 12, 16, 'code point not in range(0x110000)')
Traceback (most recent call last):
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/server/protocol_handler.py", line 97, in handle
work = await handler(message, connection)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/server/session.py", line 94, in _needs_document_lock_wrapper
result = func(self, *args, **kwargs)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/server/session.py", line 288, in _handle_patch
message.apply_to_document(self.document, self)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/protocol/messages/patch_doc.py", line 104, in apply_to_document
invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.payload, setter=setter))
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/document/callbacks.py", line 443, in invoke_with_curdoc
return f()
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/protocol/messages/patch_doc.py", line 104, in <lambda>
invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.payload, setter=setter))
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/document/document.py", line 376, in apply_json_patch
DocumentPatchedEvent.handle_event(self, event, setter)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/document/events.py", line 246, in handle_event
event_cls._handle_event(doc, event)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/bokeh/document/events.py", line 281, in _handle_event
cb(event.msg_data)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/site-packages/ipywidgets_bokeh/kernel.py", line 81, in receive
msg = json.loads(data)
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/json/__init__.py", line 341, in loads
s = s.decode(detect_encoding(s), 'surrogatepass')
File "/Users/jonmmease/miniconda3/envs/try_solara/lib/python3.10/encodings/utf_32_be.py", line 11, in decode
return codecs.utf_32_be_decode(input, errors, True)
UnicodeDecodeError: 'utf-32-be' codec can't decode bytes in position 12-15: code point not in range(0x110000)
It looks like the issue is related to the _request_msg
being provided as binary.
Here's the definitions of this prop on the Python side of the widget (See https://github.com/hex-inc/vegafusion/blob/main/python/vegafusion-jupyter/vegafusion_jupyter/widget.py#L31-L32)
from traitlets import CBytes
class VegaFusionWidget(DOMWidget):
...
# Message transport properties
_request_msg = CBytes(allow_none=True, read_only=True).tag(sync=True)
_response_msg = CBytes(allow_none=True).tag(sync=True)
My guess is that the CBytes
traitlet type is not supported by ipywidgets_bokeh
1.4.0.
Thanks for the update @jonmmease! I'd love to support VegaFusion properly and we'll probably do two things to make that happen:
I'll reach out when we're ready to start on that.
Just wanted to pass along an update. I've reworked the VegaFusion architecture a bit to make it possible to integrate VegaFusion into Altair's regular JupyterChart. See https://github.com/altair-viz/altair/pull/3281.
This doesn't require binary serialization and already works well with Panel. I'm going to deprecate VegaFusionWidget
in the future and direct people to JupyterChart
. If you wanted, it should be possible to do something similar with the Vega pane, where VegaFusion is used automatically when it's enabled in Altair.
@philippjfr
Panel: 0.12.6 vegafusion-jupyter: 0.0.2 vega-datasets 0.9.0 ipywidgets-bokeh 1.2.1
I'm trying to use the VegaFusionWidget ipywidget with Panel. See https://github.com/vegafusion/vegafusion/issues/62. But its raising the error below.