Skip to content

Commit

Permalink
Add an extra try when resolving attributes lookup (#5780)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Jul 7, 2023
1 parent b34777c commit 8e85674
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions holoviews/plotting/bokeh/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from ...core.options import CallbackError
from ...core.util import (
datetime_types, dimension_sanitizer, dt64_to_dt
datetime_types, dimension_sanitizer, dt64_to_dt, isequal
)
from ...element import Table
from ...streams import (
Expand Down Expand Up @@ -234,7 +234,7 @@ def resolve_attr_spec(cls, spec, cb_obj, model=None):
be the same as the model.
"""
if not cb_obj:
raise Exception(f'Bokeh plot attribute {spec} could not be found')
raise AttributeError(f'Bokeh plot attribute {spec} could not be found')
if model is None:
model = cb_obj
spec = spec.split('.')
Expand Down Expand Up @@ -337,15 +337,18 @@ async def process_on_change(self):
else:
obj_handle = attr_path[0]
cb_obj = self.plot_handles.get(obj_handle)
msg[attr] = self.resolve_attr_spec(path, cb_obj)
try:
msg[attr] = self.resolve_attr_spec(path, cb_obj)
except Exception:
# To give BokehJS a chance to update the model
# https://github.com/holoviz/holoviews/issues/5746
await asyncio.sleep(0.05)
msg[attr] = self.resolve_attr_spec(path, cb_obj)

if self.skip_change(msg):
equal = True
else:
try:
equal = msg == self._prev_msg
except Exception:
equal = False
equal = isequal(msg, self._prev_msg)

if not equal or any(s.transient for s in self.streams):
self.on_msg(msg)
Expand Down

0 comments on commit 8e85674

Please sign in to comment.