It works when self.bokeh_pane is nested in pn.Column but not when nested in pn.Tabs where it proceeds to throw the error:
AttributeError: unexpected attribute 'children' to Tabs, possible attributes are active, align, aspect_ratio, background, css_classes, disabled, height, height_policy, js_event_callbacks, js_property_callbacks, margin, max_height, max_width, min_height, min_width, name, sizing_mode, subscribed_events, syncable, tabs, tabs_location, tags, visible, width or width_policy [76]:
Complete, minimal, self-contained example code that reproduces the issue
# This works:
class MVP(param.Parameterized):
test = param.Selector()
action = param.Action(lambda x: x.param.trigger('action'), label='Run Query')
@param.depends('action', watch=True)
def execute(self):
print('action!')
self.bokeh_pane.object = bokeh.models.Div(text='Hello World!')
def view(self):
controls = pn.Param(self.param, widgets={
'action': {'button_type': 'primary'},
})
self.bokeh_pane = pn.pane.Bokeh(bokeh.models.Div(text='Hello'))
return pn.Tabs(
('Controls', controls),
('Plots', pn.Column(self.bokeh_pane)),
)
m = MVP()
m.view()
# Changing this line causes it to fail:
...
return pn.Tabs(
('Controls', controls),
('Plots', self.bokeh_pane),
)
Click to expand!
Traceback (most recent call last):
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/pyviz_comms/__init__.py", line 325, in _handle_msg
self._on_msg(msg)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/panel/viewable.py", line 272, in _on_msg
patch.apply_to_document(doc, comm.id)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/protocol/messages/patch_doc.py", line 115, in apply_to_document
invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.content, setter))
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/document/callbacks.py", line 408, in invoke_with_curdoc
return f()
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/protocol/messages/patch_doc.py", line 115, in
invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.content, setter))
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/document/document.py", line 391, in apply_json_patch
DocumentPatchedEvent.handle_json(self, event_json, references, setter)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/document/events.py", line 259, in handle_json
handler(doc, event_json, references, setter)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/document/events.py", line 300, in _handle_json
cb(event_json["msg_data"])
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/document/callbacks.py", line 355, in trigger_json_event
model._trigger_event(event)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/util/callback_manager.py", line 119, in _trigger_event
self.document.callbacks.notify_event(cast(Model, self), event, invoke)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/document/callbacks.py", line 247, in notify_event
invoke_with_curdoc(doc, callback_invoker)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/document/callbacks.py", line 408, in invoke_with_curdoc
return f()
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/util/callback_manager.py", line 115, in invoke
cast(EventCallbackWithEvent, callback)(event)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/panel/widgets/button.py", line 119, in _server_click
self._change_event(doc)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/panel/reactive.py", line 288, in _change_event
self._process_events(events)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/panel/reactive.py", line 262, in _process_events
self.param.set_param(**self_events)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 1472, in set_param
self_._batch_call_watchers()
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 1611, in _batch_call_watchers
self_._execute_watcher(watcher, events)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 1573, in _execute_watcher
watcher.fn(*args, **kwargs)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/panel/param.py", line 454, in action
value(self.object)
File "", line 4, in
action = param.Action(lambda x: x.param.trigger('action'), label='Run Query')
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 1541, in trigger
self_.set_param(**dict(params, **triggers))
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 1472, in set_param
self_._batch_call_watchers()
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 1611, in _batch_call_watchers
self_._execute_watcher(watcher, events)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 1573, in _execute_watcher
watcher.fn(*args, **kwargs)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 520, in caller
return function()
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 351, in _depends
return func(*args,**kw)
File "", line 9, in execute
self.bokeh_pane.object = bokeh.models.Div(text='Hello World!')
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 316, in _f
instance_param.__set__(obj, val)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 318, in _f
return f(self, obj, val)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 936, in __set__
obj.param._call_watcher(watcher, event)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 1591, in _call_watcher
self_._execute_watcher(watcher, (event,))
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/param/parameterized.py", line 1573, in _execute_watcher
watcher.fn(*args, **kwargs)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/panel/pane/base.py", line 198, in _update_pane
self._update_object(ref, doc, root, parent, comm)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/panel/pane/base.py", line 173, in _update_object
index = parent.children.index(old_model)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/core/has_props.py", line 264, in __getattr__
self._raise_attribute_error_with_matches(name, properties)
File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/core/has_props.py", line 272, in _raise_attribute_error_with_matches
raise AttributeError(f"unexpected attribute {name!r} to {self.__class__.__name__}, {text} attributes are {nice_join(matches)}")
AttributeError: unexpected attribute 'children' to Tabs, possible attributes are active, align, aspect_ratio, background, css_classes, disabled, height, height_policy, js_event_callbacks, js_property_callbacks, margin, max_height, max_width, min_height, min_width, name, sizing_mode, subscribed_events, syncable, tabs, tabs_location, tags, visible, width or width_policy
[78]:
Thanks so much for creating this amazing plugin. This is not a high priority fix since I've already found a workaround but wanted to contribute this little tidbit in case it's important to you.
ALL software version info
(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc) panel==0.12.4 param==1.10.1 bokeh==2.4.1
Others:
Click to expand
anyio==3.5.0 appdirs==1.4.4 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 attrs==21.4.0 Babel==2.9.1 backcall==0.2.0 backports.zoneinfo==0.2.1 beautifulsoup4==4.10.0 bleach==4.1.0 bokeh==2.4.1 bokehtools==0.20.0 bokehtools-tomas @ file:///home/tcastrosantos/DATA-578_iso_DAG/bokehtools_tomas-0.12.0-py3-none-any.whl boto3==1.18.13 botocore==1.21.65 bouncer-client==0.4.0 caspian==2.1.10.post8675 caspian-presto-client==2.1.10.post8675 certifi==2019.9.11 cffi==1.15.0 charset-normalizer==2.0.12 click==8.0.4 cloudpickle==2.0.0 colorama==0.4.4 colorcet==3.0.0 configparser==5.2.0 cryptography==36.0.1 cycler==0.11.0 dask==2021.12.0 datalake-presto-client==2.1.10.post8675 datashader==0.12.1 datashape==0.5.2 datatank-client==2.1.10.post8675 dataworks-bouncer-auth==2.1.10.post8675 dataworks-common==2.1.10.post8675 decorator==5.1.1 defusedxml==0.7.1 directives-client==0.4.2 distlib==0.3.2 distributed==2021.12.0 entrypoints==0.4 event-frames==0.5.0 fastjsonschema==2.15.3 filelock==3.0.12 fsspec==2022.2.0 future==0.18.2 greenlet==1.1.2 HeapDict==1.0.1 holoviews==1.14.3 idna==3.3 importlib-metadata==4.5.0 importlib-resources==5.6.0 ipykernel==4.8.2 ipython==7.32.0 ipython-genutils==0.2.0 jedi==0.18.1 Jinja2==3.0.3 jira==2.0.0 jmespath==0.10.0 json5==0.9.6 jsonschema==4.4.0 jupyter-client==7.1.2 jupyter-core==4.9.2 jupyter-server==1.16.0 jupyterlab==3.3.2 jupyterlab-pygments==0.1.2 jupyterlab-server==2.12.0 jupyterlab-vim==0.15.1 jupyterlab-vimrc==0.5.2 kiwisolver==1.3.2 llvmlite==0.38.0 locket==0.2.1 Markdown==3.3.6 MarkupSafe==2.1.0 matplotlib==2.2.2 matplotlib-inline==0.1.3 mistune==0.8.4 msgpack==1.0.3 multipledispatch==0.6.0 nbclassic==0.3.7 nbclient==0.5.13 nbconvert==6.4.5 nbformat==5.3.0 nest-asyncio==1.5.4 networkx==2.6.3 notebook==6.4.10 notebook-shim==0.1.0 numba==0.55.1 numpy==1.20.3 oauthlib==3.2.0 packaging==21.3 pandas==1.2.4 pandocfilters==1.5.0 panel==0.12.4 param==1.10.1 parso==0.8.3 partd==1.2.0 pbr==5.8.1 pexpect==4.8.0 pickleshare==0.7.5 Pillow==9.0.1 prometheus-client==0.14.0 prompt-toolkit==3.0.28 psutil==5.9.0 ptyprocess==0.7.0 pyarrow==2.0.0 pycparser==2.21 pyct==0.4.8 Pygments==2.11.2 PyHive==0.6.5 PyJWT==1.7.1 pymssql==2.1.4 PyMySQL==0.8.1 pyodbc==4.0.27 pyparsing==3.0.7 pyrsistent==0.18.1 pyspork==2.2.0 python-dateutil==2.8.2 pytz==2021.3 pytz-deprecation-shim==0.1.0.post0 pyviz-comms==2.1.0 PyYAML==3.12 pyzmq==22.3.0 redis==3.5.3 requests==2.27.1 requests-oauthlib==1.3.1 requests-toolbelt==0.9.1 s3transfer==0.5.2 scipy==1.6.3 seaborn==0.11.2 Send2Trash==1.8.0 sentry-sdk==1.5.7 six==1.16.0 sniffio==1.2.0 sortedcontainers==2.4.0 soupsieve==2.3.2 SQLAlchemy==1.4.36 structlog==19.2.0 tabulate==0.8.9 tblib==1.7.0 terminado==0.13.3 tesladex-client==0.6.0 testpath==0.6.0 toolz==0.11.2 tornado==6.1 tqdm==4.52.0 traitlets==5.1.1 typing-extensions==3.10.0.0 tzdata==2021.5 tzlocal==4.1 urllib3==1.26.8 virtualenv==20.4.7 wcwidth==0.2.5 webencodings==0.5.1 websocket-client==1.3.2 xarray==0.20.2 zict==2.1.0 zipp==3.4.1Description of expected behavior and the observed behavior
In jupyterlab, I'm attempting to update the value of a bokeh pane by setting
It works when
self.bokeh_pane
is nested inpn.Column
but not when nested inpn.Tabs
where it proceeds to throw the error:AttributeError: unexpected attribute 'children' to Tabs, possible attributes are active, align, aspect_ratio, background, css_classes, disabled, height, height_policy, js_event_callbacks, js_property_callbacks, margin, max_height, max_width, min_height, min_width, name, sizing_mode, subscribed_events, syncable, tabs, tabs_location, tags, visible, width or width_policy [76]:
Complete, minimal, self-contained example code that reproduces the issue
Stack traceback and/or browser JavaScript console output
Click to expand!
Traceback (most recent call last): File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/pyviz_comms/__init__.py", line 325, in _handle_msg self._on_msg(msg) File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/panel/viewable.py", line 272, in _on_msg patch.apply_to_document(doc, comm.id) File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/protocol/messages/patch_doc.py", line 115, in apply_to_document invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.content, setter)) File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/document/callbacks.py", line 408, in invoke_with_curdoc return f() File "/opt/tesla/dataworks/jupyterhub/venvs/dataworks/lib/python3.7/site-packages/bokeh/protocol/messages/patch_doc.py", line 115, inThanks so much for creating this amazing plugin. This is not a high priority fix since I've already found a workaround but wanted to contribute this little tidbit in case it's important to you.
Thanks again :)