Dynamicmap in Bokeh server fails in lookup_function of options.py
See original GitHub issueYour following example for dynamicmap fails with the following error and doesn’t show any thing in the browser. OS: Ubuntu 16.06 Browser Chrome Bokeh: 0.12.13 Holoviews: 1.9.2 master on 05/02/2018 Python 3.6
Thanks
python
from bokeh.io import curdoc
import holoviews as hv
renderer = hv.renderer('bokeh')
doc = curdoc()
frequencies = [0.5, 0.75, 1.0, 1.25]
def sine_curve(phase, freq):
xvals = [0.1* i for i in range(100)]
return hv.Curve((xvals, [np.sin(phase+freq*x) for x in xvals]))
dmap = hv.DynamicMap(sine_curve, kdims=['phase', 'frequency'])
dmap.redim.range(phase=(0.5,1)).redim.range(frequency=(0.5,1.25))
layout = renderer.get_plot(dmap, doc).state
doc.add_root(layout)
2018-02-05 22:57:48,165 Starting Bokeh server version 0.12.13 (running on Tornado 4.5.3) 2018-02-05 22:57:48,167 Bokeh app running at: http://localhost:5006/plt0 2018-02-05 22:57:48,167 Starting Bokeh server with process id: 29987 2018-02-05 22:57:53,668 Error running application handler <bokeh.application.handlers.script.ScriptHandler object at 0x7f12d6b81400>: ‘NoneType’ object has no attribute ‘id’ File “options.py”, line 1143, in lookup_options: if obj.id in cls._custom_options[backend]: Traceback (most recent call last): File “bokeh/application/handlers/code_runner.py”, line 125, in run exec(self._code, module.dict) File “plt0.py”, line 16, in layout = renderer.get_plot(dmap, doc).state File “holoviews-1.9.2-py3.6.egg/holoviews/plotting/bokeh/renderer.py”, line 123, in get_plot plot = super(BokehRenderer, self_or_cls).get_plot(obj, renderer) File “holoviews-1.9.2-py3.6.egg/holoviews/plotting/renderer.py”, line 177, in get_plot plot_opts = self_or_cls.plot_options(obj, self_or_cls.size) File “holoviews-1.9.2-py3.6.egg/holoviews/plotting/bokeh/renderer.py”, line 282, in plot_options options = plot.lookup_options(obj, ‘plot’).options File “holoviews-1.9.2-py3.6.egg/holoviews/plotting/plot.py”, line 81, in lookup_options node = Store.lookup_options(cls.backend, obj, group) File “holoviews-1.9.2-py3.6.egg/holoviews/core/options.py”, line 1143, in lookup_options if obj.id in cls._custom_options[backend]: AttributeError: ‘NoneType’ object has no attribute ‘id’
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
Yes, thanks for pointing that out! I’d do this instead:
Nonetheless this should raise a better error so I’ll leave the issue open.
Yes, a) you can declare a DynamicMap without dimensions which is common when using
streams
, and b) you can explicitly declare the ranges/values on the Dimensions when you declare a DynamicMap. I think the issue here was that usually the DynamicMap is validated beforeget_plot
is called, I think all that needs to happen is to move the DynamicMap validation intoRenderer._validate
.