Search code examples
bokehrangeslider

RangeSlider unexpeted attribute Bokeh


I am trying to use the RangeSlider within my Bokeh-application, initializing the object as so

from bokeh.models.widgets import RangeSlider

#RangeSlider
slider = RangeSlider(title="OAS slider", start=0, end=1000, value=(0,2000), 
                     step=0.1)

When trying to compile the app I get the following error message:

AttributeError: unexpected attribute 'value' to RangeSlider, possible attributes are 
callback, callback_policy, callback_throttle, css_classes, disabled, end, 
height, js_callbacks, name, orientation, range, sizing_mode, start, step, 
tags, title or width

I could change the code to use range instead as so

#RangeSlider altered inputs
slider = RangeSlider(title="OAS slider", start=0, end=1000, range=(0,2000), 
                     step=0.1)

and it works.

However, as the example on the Bokeh-homepage found here

https://github.com/bokeh/bokeh/blob/master/examples/app/export_csv/main.py

used the value and works, I would be more eager to understand why I get the error message, rather than just changing to range... The example in the link also used the key word format, which obviously also generates the error above.

Could be a version issue. I am running Bokeh version 0.12.4

Thanks


Solution

  • This is a version issue. The RangeSlider was actually mostly broken for a long time, until we switched to a different underlying slider library to implement it. But some changes were necessary to make the switch. The correct property for 0.12.7 and newer is value and I would recommend to use that version or later if you want too use RangeSlider especially (0.12.4 is over a year old.)