/srv/conda/envs/notebook/lib/python3.7/site-packages/traitlets/traitlets.py in _validate(self, obj, value)
610 return value
611 if hasattr(self, 'validate'):
--> 612 value = self.validate(obj, value)
613 if obj._cross_validation_lock is False:
614 value = self._cross_validate(obj, value)
/srv/conda/envs/notebook/lib/python3.7/site-packages/traitlets/traitlets.py in validate(self, obj, value)
2044 def validate(self, obj, value):
2045 if not isinstance(value, int):
-> 2046 self.error(obj, value)
2047 return _validate_bounds(self, obj, value)
2048
/srv/conda/envs/notebook/lib/python3.7/site-packages/traitlets/traitlets.py in error(self, obj, value, error, info)
690 e = "The '%s' trait expected %s, not %s." % (
691 self.name, self.info(), describe("the", value))
--> 692 raise TraitError(e)
693
694 def get_metadata(self, key, default=None):
TraitError: The 'index' trait of a SelectionSlider instance expected an int, not the float 2.0000000000000004.
Description
The SelectionSlider widget occasionally fails to display options from a list. Opening the notebook log shows a TraitError.
Reproduce
widgets.SelectionSlider( options=options_list, value=options_list[0], description='I like my eggs ...', disabled=False, continuous_update=False, orientation='horizontal', readout=True )
TraitError Traceback (most recent call last) ~/python/ipywidgets/ipywidgets/widgets/widget.py in _handle_msg(self, msg) 676 if 'buffer_paths' in data: 677 _put_buffers(state, data['buffer_paths'], msg['buffers']) --> 678 self.set_state(state) 679 680 # Handle a state request.
~/python/ipywidgets/ipywidgets/widgets/widget.py in set_state(self, sync_data) 558 from_json = self.trait_metadata(name, 'from_json', 559 self._trait_from_json) --> 560 self.set_trait(name, from_json(sync_data[name], self)) 561 562 def send(self, content, buffers=None):
/srv/conda/envs/notebook/lib/python3.7/site-packages/traitlets/traitlets.py in set_trait(self, name, value) 1436 (cls.name, name)) 1437 else: -> 1438 getattr(cls, name).set(self, value) 1439 1440 @classmethod
/srv/conda/envs/notebook/lib/python3.7/site-packages/traitlets/traitlets.py in set(self, obj, value) 578 579 def set(self, obj, value): --> 580 new_value = self._validate(obj, value) 581 try: 582 old_value = obj._trait_values[self.name]
/srv/conda/envs/notebook/lib/python3.7/site-packages/traitlets/traitlets.py in _validate(self, obj, value) 610 return value 611 if hasattr(self, 'validate'): --> 612 value = self.validate(obj, value) 613 if obj._cross_validation_lock is False: 614 value = self._cross_validate(obj, value)
/srv/conda/envs/notebook/lib/python3.7/site-packages/traitlets/traitlets.py in validate(self, obj, value) 2044 def validate(self, obj, value): 2045 if not isinstance(value, int): -> 2046 self.error(obj, value) 2047 return _validate_bounds(self, obj, value) 2048
/srv/conda/envs/notebook/lib/python3.7/site-packages/traitlets/traitlets.py in error(self, obj, value, error, info) 690 e = "The '%s' trait expected %s, not %s." % ( 691 self.name, self.info(), describe("the", value)) --> 692 raise TraitError(e) 693 694 def get_metadata(self, key, default=None):
TraitError: The 'index' trait of a SelectionSlider instance expected an int, not the float 2.0000000000000004.