Inconsequential error? "set changed size during iteration"

With the code below i get a RuntimeError(‘Set changed size during iteration’,) message when clicking on the buttons, but the callback is doing exactly what it;s meant to do (adds buttons) and the added buttons work well too. It seems the set changed size error has no effect at all, or does it? Not sure if I should be concerned by it

I use python 3.7 and bokeh 1.1.0

from bokeh.io import curdoc
from bokeh.models import Button
from bokeh.layouts import widgetbox

def add_button():
box = curdoc().select_one({“name”:“test”})
n = len(box.children)
button = Button(label=‘test{}’.format(n))
button.on_click(add_button)
box.children += [button]

button = Button(label=‘test’)
button.on_click(add_button)

box = widgetbox([button],name=‘test’)

curdoc().add_root(box)

``

Hi,

This was fixed in properly handle callbacks added during other event callbacks by bryevdv · Pull Request #8837 · bokeh/bokeh · GitHub which is merged for 1.1.1

Thanks,

Bryan

···

On May 9, 2019, at 8:22 AM, Sébastien Roche <[email protected]> wrote:

With the code below i get a RuntimeError('Set changed size during iteration',) message when clicking on the buttons, but the callback is doing exactly what it;s meant to do (adds buttons) and the added buttons work well too. It seems the set changed size error has no effect at all, or does it? Not sure if I should be concerned by it

I use python 3.7 and bokeh 1.1.0

from bokeh.io import curdoc
from bokeh.models import Button
from bokeh.layouts import widgetbox

def add_button():
    box = curdoc().select_one({"name":"test"})
    n = len(box.children)
    button = Button(label='test{}'.format(n))
    button.on_click(add_button)
    box.children += [button]

button = Button(label='test')
button.on_click(add_button)

box = widgetbox([button],name='test')

curdoc().add_root(box)

--
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/284d7306-4cdf-40b0-adf5-602439c53933%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.