I seem to be having an issue with adding new lines to an existing figure that’s being rendered. I’ve attempted two ways of doing this: (1) by simply calling the line method on the figure with a new ColumnDataSource; and (2) pre-composing the ColumnDataSource and all line GlyphRenders, and attempting to update the single ColumnDataSource with new information.
In both cases, I receive this error:
RuntimeError: _pending_writes should be non-None when we have a document lock, and we should have the lock when the document changes
(Full trace here: http://pastebin.com/y6psNQDT)
Currently, this plot is being rendered in a PyQt QWebEngineView (QWebEngineView Class | Qt WebEngine 5.15.7), and the attempt to add a new line to the figure is done through a button callback in the Qt UI, which simple calls the “add_data” method. The setup is simple:
class BokehPlot(Plotter):
def init(self, *args, **kwargs):
super(BokehPlot, self).init(*args, **kwargs)
self._fig = figure(sizing_mode='stretch_both')
app = Application(FunctionHandler(
lambda doc: doc.add_root(column(self._fig,
sizing_mode='stretch_both'))))
self._server = Server({'/': app}, io_loop=io_loop, port=next(ports))
self._server.start()
self.web_engine_view.setUrl(QUrl("http://localhost:{}/".format(
self._server.port)))
def add_data(self, x, y):
source = ColumnDataSource(data={'x': x, 'y': y})
self._fit.plot('x', 'y', source=source)
I’m hoping that someone has come across this particular bug, and could let me know if it’s a limitation of using Qt and Bokeh together, or something else.
Thanks in advance,
Nick