Set selection

Hello,

I have a weird bug in my script and I can’t figure out what’s causing it.

I’ve added a search tool, when you click a button it performs a search in a dataframe loaded from a pickle file and returns a list with row numbers that should be selected. I put this list in the Selection model and it causes an error when I set the selection model as source.selected.
2018-05-27 12:59:32,669 error handling message Message ‘PATCH-DOC’ (revision 1): TypeError(‘sequence item 0: expected str instance, list found’,)
2018-05-27 12:59:32,669 message header {‘msgtype’: ‘PATCH-DOC’, ‘msgid’: ‘5C82D5EEFF164BFEA8F5DCF9FE805528’} content {‘events’: [{‘kind’: ‘ModelChanged’, ‘new’: 1, ‘model’: {‘id’: ‘cb523304-f8b7-468e-9907-f8f8bf1f58c3’, ‘type’: ‘Button’}, ‘attr’: ‘clicks’}], ‘references’: }
Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/bokeh/server/protocol_handler.py”, line 70, in handle
work = yield handler(message, connection)
File “/usr/local/lib/python3.5/dist-packages/tornado/gen.py”, line 1099, in run
value = future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 274, in result
raise self._exception
File “/usr/local/lib/python3.5/dist-packages/tornado/gen.py”, line 1113, in run
yielded = self.gen.send(value)
File “/usr/local/lib/python3.5/dist-packages/bokeh/server/session.py”, line 51, in _needs_document_lock_wrapper
result = yield yield_for_all_futures(func(self, *args, **kwargs))
File “/usr/local/lib/python3.5/dist-packages/bokeh/server/session.py”, line 223, in _handle_patch
message.apply_to_document(self.document, self)
File “/usr/local/lib/python3.5/dist-packages/bokeh/protocol/messages/patch_doc.py”, line 69, in apply_to_document
doc.apply_json_patch(self.content, setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 339, in apply_json_patch
patched_obj.set_from_json(attr, value, models=references, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/has_props.py”, line 330, in set_from_json
descriptor.set_from_json(self, json, models, setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 576, in set_from_json
models, setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 285, in set_from_json
self._internal_set(obj, json, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 727, in _internal_set
self._real_set(obj, old, value, hint=hint, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 796, in _real_set
self._trigger(obj, old, value, hint=hint, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 873, in _trigger
obj.trigger(self.name, old, value, hint, setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/model.py”, line 549, in trigger
super(Model, self).trigger(attr, old, new, hint=hint, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/util/callback_manager.py”, line 118, in trigger
self._document._notify_change(self, attr, old, new, hint, setter, invoke)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 941, in _notify_change
self._trigger_on_change(event)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 1042, in _trigger_on_change
self._with_self_as_curdoc(event.callback_invoker)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 1060, in _with_self_as_curdoc
return f()
File “/usr/local/lib/python3.5/dist-packages/bokeh/util/callback_manager.py”, line 116, in invoke
callback(attr, old, new)
File “/usr/local/lib/python3.5/dist-packages/bokeh/models/widgets/buttons.py”, line 63, in
self.on_change(‘clicks’, lambda attr, old, new: handler())
File “/home/jasper/Desktop/bdepth/bpsys/Go_vizserver_dev.py”, line 99, in update
source.selected = Selection(indices=select)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/has_props.py”, line 263, in setattr
super(HasProps, self).setattr(name, value)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 503, in set
self._internal_set(obj, value, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 727, in _internal_set
self._real_set(obj, old, value, hint=hint, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 796, in _real_set
self._trigger(obj, old, value, hint=hint, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 873, in _trigger
obj.trigger(self.name, old, value, hint, setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/model.py”, line 549, in trigger
super(Model, self).trigger(attr, old, new, hint=hint, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/util/callback_manager.py”, line 118, in trigger
self._document._notify_change(self, attr, old, new, hint, setter, invoke)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 941, in _notify_change
self._trigger_on_change(event)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 1042, in _trigger_on_change
self._with_self_as_curdoc(event.callback_invoker)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 1060, in _with_self_as_curdoc
return f()
File “/usr/local/lib/python3.5/dist-packages/bokeh/util/callback_manager.py”, line 116, in invoke
callback(attr, old, new)
File “/home/jasper/Desktop/bdepth/bpsys/Go_vizserver_dev.py”, line 352, in tapped
selectedTerm.value=’, '.join(df.iloc[source.selected.indices,1].tolist())
TypeError: sequence item 0: expected str instance, list found

``

Code:

def search_select(search_value, accuracy_value, desc_value, importance_value=(0,0)):
selected = df
if search_value != “”:
selected = selected[selected.Term.str.contains(’|’.join(str(search_value).replace(’, ‘, ‘,’).split(’,’)), case=False) == True]
else:
selected = df
if desc_value != “”:
selected = selected[selected.SearchDescription.str.contains(’|’.join(str(desc_value).replace(’, ‘, ‘,’).split(’,’)), case=False) == True]
else:
selected = selected
selected = selected[(selected.Score1 >= accuracy_value[0]) & (selected.Score1 <= accuracy_value[1])]
if args.models == 2:
selected = selected[(selected.Score2 >= accuracy_value[0]) & (selected.Score2 <= accuracy_value[1])]
if args.importance:
selected = selected[(selected.Importance >= importance_value[0]) & (selected.Importance <= importance_value[1])]
return selected.index.tolist()

def update():
if args.importance:
select = search_select(search.value, accuracy_slider.value, searchDesc.value, importance_slider.value)
else:
select = search_select(search.value, accuracy_slider.value, searchDesc.value)
print(select) #[0, 1, 2, 3, 4, 5, 6, 7, 8]
source.selected = Selection(indices=select)

button.on_click(update)

``

It only works when there’s only 1 int in the selection model, it throws an error when I add more.

source.selected = Selection(indices=[1])

What am I doing wrong?

Versions:

Bokeh server: 0.12.16

Tornado: 5.0.2

Python 3.5.2

Kind regards,

Jasper

Hi,

That exception is coming from your code. The str.join method expects a list of strings, but evidently you are passing it as list of lists. I'm not sure what your exact data is but here is am minimal example that demonstrates the kind of input that can cause that error:

  In [1]: ",".join([ [1], [2] ])

···

---------------------------------------------------------------------------
  TypeError Traceback (most recent call last)
  <ipython-input-1-16bd8a8707cb> in <module>()
  ----> 1 ",".join([ [1], [2] ])

  TypeError: sequence item 0: expected str instance, list found

As a tangential note, it's always advise to change the smallest thing necessary. In this case you are replacing an entire Selection model

  source.selected = Selection(...) # BAD

Instead,you can and should just be updating the "indices" property on the existing selection:

  source.selected.indices = new_selection # GOOD

Thanks,

Bryan

On May 27, 2018, at 04:47, [email protected] wrote:

Hello,

I have a weird bug in my script and I can't figure out what's causing it.
I've added a search tool, when you click a button it performs a search in a dataframe loaded from a pickle file and returns a list with row numbers that should be selected. I put this list in the Selection model and it causes an error when I set the selection model as source.selected.
2018-05-27 12:59:32,669 error handling message Message 'PATCH-DOC' (revision 1): TypeError('sequence item 0: expected str instance, list found',)
2018-05-27 12:59:32,669 message header {'msgtype': 'PATCH-DOC', 'msgid': '5C82D5EEFF164BFEA8F5DCF9FE805528'} content {'events': [{'kind': 'ModelChanged', 'new': 1, 'model': {'id': 'cb523304-f8b7-468e-9907-f8f8bf1f58c3', 'type': 'Button'}, 'attr': 'clicks'}], 'references': }
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/bokeh/server/protocol_handler.py", line 70, in handle
    work = yield handler(message, connection)
  File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 1099, in run
    value = future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 1113, in run
    yielded = self.gen.send(value)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/server/session.py", line 51, in _needs_document_lock_wrapper
    result = yield yield_for_all_futures(func(self, *args, **kwargs))
  File "/usr/local/lib/python3.5/dist-packages/bokeh/server/session.py", line 223, in _handle_patch
    message.apply_to_document(self.document, self)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/protocol/messages/patch_doc.py", line 69, in apply_to_document
    doc.apply_json_patch(self.content, setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py", line 339, in apply_json_patch
    patched_obj.set_from_json(attr, value, models=references, setter=setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/core/has_props.py", line 330, in set_from_json
    descriptor.set_from_json(self, json, models, setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py", line 576, in set_from_json
    models, setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py", line 285, in set_from_json
    self._internal_set(obj, json, setter=setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py", line 727, in _internal_set
    self._real_set(obj, old, value, hint=hint, setter=setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py", line 796, in _real_set
    self._trigger(obj, old, value, hint=hint, setter=setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py", line 873, in _trigger
    obj.trigger(self.name, old, value, hint, setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/model.py", line 549, in trigger
    super(Model, self).trigger(attr, old, new, hint=hint, setter=setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/util/callback_manager.py", line 118, in trigger
    self._document._notify_change(self, attr, old, new, hint, setter, invoke)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py", line 941, in _notify_change
    self._trigger_on_change(event)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py", line 1042, in _trigger_on_change
    self._with_self_as_curdoc(event.callback_invoker)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py", line 1060, in _with_self_as_curdoc
    return f()
  File "/usr/local/lib/python3.5/dist-packages/bokeh/util/callback_manager.py", line 116, in invoke
    callback(attr, old, new)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/models/widgets/buttons.py", line 63, in <lambda>
    self.on_change('clicks', lambda attr, old, new: handler())
  File "/home/jasper/Desktop/bdepth/bpsys/Go_vizserver_dev.py", line 99, in update
    source.selected = Selection(indices=select)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/core/has_props.py", line 263, in __setattr__
    super(HasProps, self).__setattr__(name, value)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py", line 503, in __set__
    self._internal_set(obj, value, setter=setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py", line 727, in _internal_set
    self._real_set(obj, old, value, hint=hint, setter=setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py", line 796, in _real_set
    self._trigger(obj, old, value, hint=hint, setter=setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py", line 873, in _trigger
    obj.trigger(self.name, old, value, hint, setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/model.py", line 549, in trigger
    super(Model, self).trigger(attr, old, new, hint=hint, setter=setter)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/util/callback_manager.py", line 118, in trigger
    self._document._notify_change(self, attr, old, new, hint, setter, invoke)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py", line 941, in _notify_change
    self._trigger_on_change(event)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py", line 1042, in _trigger_on_change
    self._with_self_as_curdoc(event.callback_invoker)
  File "/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py", line 1060, in _with_self_as_curdoc
    return f()
  File "/usr/local/lib/python3.5/dist-packages/bokeh/util/callback_manager.py", line 116, in invoke
    callback(attr, old, new)
  File "/home/jasper/Desktop/bdepth/bpsys/Go_vizserver_dev.py", line 352, in tapped
    selectedTerm.value=', '.join(df.iloc[source.selected.indices,1].tolist())
TypeError: sequence item 0: expected str instance, list found

Code:
def search_select(search_value, accuracy_value, desc_value, importance_value=(0,0)):
    selected = df
    if search_value != "":
        selected = selected[selected.Term.str.contains('|'.join(str(search_value).replace(', ', ',').split(',')), case=False) == True]
    else:
        selected = df
    if desc_value != "":
        selected = selected[selected.SearchDescription.str.contains('|'.join(str(desc_value).replace(', ', ',').split(',')), case=False) == True]
    else:
        selected = selected
    selected = selected[(selected.Score1 >= accuracy_value[0]) & (selected.Score1 <= accuracy_value[1])]
    if args.models == 2:
        selected = selected[(selected.Score2 >= accuracy_value[0]) & (selected.Score2 <= accuracy_value[1])]
    if args.importance:
        selected = selected[(selected.Importance >= importance_value[0]) & (selected.Importance <= importance_value[1])]
    return selected.index.tolist()

def update():
    if args.importance:
        select = search_select(search.value, accuracy_slider.value, searchDesc.value, importance_slider.value)
    else:
        select = search_select(search.value, accuracy_slider.value, searchDesc.value)
    print(select) #[0, 1, 2, 3, 4, 5, 6, 7, 8]
    source.selected = Selection(indices=select)

button.on_click(update)

It only works when there's only 1 int in the selection model, it throws an error when I add more.
source.selected = Selection(indices=[1])

What am I doing wrong?

Versions:
Bokeh server: 0.12.16
Tornado: 5.0.2
Python 3.5.2

Kind regards,
Jasper

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/97d97bec-7fcf-4b84-bdf8-3367583da43d%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thanks for your help!

Changing the indices property on the existing selection fixed the problem.

Kind regards,

Jasper

···

Op zondag 27 mei 2018 15:30:56 UTC+2 schreef Jasper van Dalum:

Hello,

I have a weird bug in my script and I can’t figure out what’s causing it.

I’ve added a search tool, when you click a button it performs a search in a dataframe loaded from a pickle file and returns a list with row numbers that should be selected. I put this list in the Selection model and it causes an error when I set the selection model as source.selected.
2018-05-27 12:59:32,669 error handling message Message ‘PATCH-DOC’ (revision 1): TypeError(‘sequence item 0: expected str instance, list found’,)
2018-05-27 12:59:32,669 message header {‘msgtype’: ‘PATCH-DOC’, ‘msgid’: ‘5C82D5EEFF164BFEA8F5DCF9FE805528’} content {‘events’: [{‘kind’: ‘ModelChanged’, ‘new’: 1, ‘model’: {‘id’: ‘cb523304-f8b7-468e-9907-f8f8bf1f58c3’, ‘type’: ‘Button’}, ‘attr’: ‘clicks’}], ‘references’: }
Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/bokeh/server/protocol_handler.py”, line 70, in handle
work = yield handler(message, connection)
File “/usr/local/lib/python3.5/dist-packages/tornado/gen.py”, line 1099, in run
value = future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 274, in result
raise self._exception
File “/usr/local/lib/python3.5/dist-packages/tornado/gen.py”, line 1113, in run
yielded = self.gen.send(value)
File “/usr/local/lib/python3.5/dist-packages/bokeh/server/session.py”, line 51, in _needs_document_lock_wrapper
result = yield yield_for_all_futures(func(self, *args, **kwargs))
File “/usr/local/lib/python3.5/dist-packages/bokeh/server/session.py”, line 223, in _handle_patch
message.apply_to_document(self.document, self)
File “/usr/local/lib/python3.5/dist-packages/bokeh/protocol/messages/patch_doc.py”, line 69, in apply_to_document
doc.apply_json_patch(self.content, setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 339, in apply_json_patch
patched_obj.set_from_json(attr, value, models=references, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/has_props.py”, line 330, in set_from_json
descriptor.set_from_json(self, json, models, setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 576, in set_from_json
models, setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 285, in set_from_json
self._internal_set(obj, json, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 727, in _internal_set
self._real_set(obj, old, value, hint=hint, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 796, in _real_set
self._trigger(obj, old, value, hint=hint, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 873, in _trigger
obj.trigger(self.name, old, value, hint, setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/model.py”, line 549, in trigger
super(Model, self).trigger(attr, old, new, hint=hint, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/util/callback_manager.py”, line 118, in trigger
self._document._notify_change(self, attr, old, new, hint, setter, invoke)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 941, in _notify_change
self._trigger_on_change(event)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 1042, in _trigger_on_change
self._with_self_as_curdoc(event.callback_invoker)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 1060, in _with_self_as_curdoc
return f()
File “/usr/local/lib/python3.5/dist-packages/bokeh/util/callback_manager.py”, line 116, in invoke
callback(attr, old, new)
File “/usr/local/lib/python3.5/dist-packages/bokeh/models/widgets/buttons.py”, line 63, in
self.on_change(‘clicks’, lambda attr, old, new: handler())
File “/home/jasper/Desktop/bdepth/bpsys/Go_vizserver_dev.py”, line 99, in update
source.selected = Selection(indices=select)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/has_props.py”, line 263, in setattr
super(HasProps, self).setattr(name, value)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 503, in set
self._internal_set(obj, value, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 727, in _internal_set
self._real_set(obj, old, value, hint=hint, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 796, in _real_set
self._trigger(obj, old, value, hint=hint, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/core/property/descriptors.py”, line 873, in _trigger
obj.trigger(self.name, old, value, hint, setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/model.py”, line 549, in trigger
super(Model, self).trigger(attr, old, new, hint=hint, setter=setter)
File “/usr/local/lib/python3.5/dist-packages/bokeh/util/callback_manager.py”, line 118, in trigger
self._document._notify_change(self, attr, old, new, hint, setter, invoke)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 941, in _notify_change
self._trigger_on_change(event)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 1042, in _trigger_on_change
self._with_self_as_curdoc(event.callback_invoker)
File “/usr/local/lib/python3.5/dist-packages/bokeh/document/document.py”, line 1060, in _with_self_as_curdoc
return f()
File “/usr/local/lib/python3.5/dist-packages/bokeh/util/callback_manager.py”, line 116, in invoke
callback(attr, old, new)
File “/home/jasper/Desktop/bdepth/bpsys/Go_vizserver_dev.py”, line 352, in tapped
selectedTerm.value=', '.join(df.iloc[source.selected.indices,1].tolist())
TypeError: sequence item 0: expected str instance, list found

``

Code:

def search_select(search_value, accuracy_value, desc_value, importance_value=(0,0)):
selected = df
if search_value != “”:
selected = selected[selected.Term.str.contains(‘|’.join(str(search_value).replace(‘, ‘, ‘,’).split(’,’)), case=False) == True]
else:
selected = df
if desc_value != “”:
selected = selected[selected.SearchDescription.str.contains(‘|’.join(str(desc_value).replace(‘, ‘, ‘,’).split(’,’)), case=False) == True]
else:
selected = selected
selected = selected[(selected.Score1 >= accuracy_value[0]) & (selected.Score1 <= accuracy_value[1])]
if args.models == 2:
selected = selected[(selected.Score2 >= accuracy_value[0]) & (selected.Score2 <= accuracy_value[1])]
if args.importance:
selected = selected[(selected.Importance >= importance_value[0]) & (selected.Importance <= importance_value[1])]
return selected.index.tolist()

def update():
if args.importance:
select = search_select(search.value, accuracy_slider.value, searchDesc.value, importance_slider.value)
else:
select = search_select(search.value, accuracy_slider.value, searchDesc.value)
print(select) #[0, 1, 2, 3, 4, 5, 6, 7, 8]
source.selected = Selection(indices=select)

button.on_click(update)

``

It only works when there’s only 1 int in the selection model, it throws an error when I add more.

source.selected = Selection(indices=[1])

What am I doing wrong?

Versions:

Bokeh server: 0.12.16

Tornado: 5.0.2

Python 3.5.2

Kind regards,

Jasper