Skip to content

Combination of "export_png()" and "show()" causes error #8362

Description

@jnettels

Hi there!
It pains me to bring up these export_png-related issues... but here I go again. This time it is an error that shows up when using export_png() and show() together:

In 0.13.0, the following works just fine:

from bokeh.models import ColumnDataSource
from bokeh.plotting import figure
from bokeh.layouts import layout
from bokeh.io import export_png, show, output_file

source = ColumnDataSource({'x': [2, 3, 4], 'y': [0.5, 1.5, 2.5]})
fig = figure(plot_width=1000, plot_height=300)
fig.hbar(y='y', right='x', height=0.4, source=source)

export_png(fig, filename="export fig.png")

doc_layout = layout([fig])

output_file('export_test.html', title='export test')
show(doc_layout)

...but in 1.0.0, it throws the following error for the line show(doc_layout):
RuntimeError: Models must be owned by only a single document, HelpTool(id='1026', ...) is already in a doc

Some observations:

  • I wonder if it has to do with the changes that allowed to fix export_png not exporting figures correctly #8020.
  • Not using either export_png or show works.
  • Using show(fig) instead of show(doc_layout) works, as well (but that is not really a workaround).
  • Using export_png after show works, too. This could be a workaround in most use cases, but is quite inconvenient in mine.

Many thanks for the 1.0 release, anyway. I read about it in the change log, and it really feels like the export function is now faster for multiple exports!

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions