Hi All, I have an automated application that composes a layout of a few divs, a data table, and a number of plots that varies according to various criteria with the data source. I use the export_png function as a step to convert an html report into a pdf document. The html is generated from from the
file_html() function which still works for me.
After updating to Bokeh 3.0.1 (with Python 3.10), the
get_screenshot_as_png function started to throw the following error:
File "/home/Documents/pdf_script.py", line 339, in create_pdf_report report_image = get_screenshot_as_png(self.Report.report_layout, driver=self.pdf_driver.driver) File "/home/Documents/django_env/lib/python3.10/site-packages/bokeh/io/export.py", line 264, in get_screenshot_as_png .resize((width, height))) File "/home/Documents/django_env/lib/python3.10/site-packages/PIL/Image.py", line 2093, in resize im = im.resize(size, resample, box) File "/home/Documentsdjango_env/lib/python3.10/site-packages/PIL/Image.py", line 2115, in resize return self._new(self.im.resize(size, resample, box)) TypeError: 'float' object cannot be interpreted as an integer
The pdf creation function is called from a much larger application, so I have tried setting up a separate script with a simple example. So far I’m unable to replicate the issue. The closest I’ve come is if I set
height attributes on the layout (a column of columns), there is no error. i.e.
layout.width, layout.height = 900, 1000
I notice that by default, these values are set to
None, regardless of how I set the
sizing_mode attribute (I had it set to ‘fixed_width’). Previously, I didn’t set a width or height in the png creation step because it didn’t appear to be required, and the resulting image was indistinguishable from what the html file produced. So I need to be able to let the height set itself as previously.
I’m going to keep trying to create a reproducible example, but in the meantime I figured I might check here to see if anyone else has encountered a similar issue and to ask for general guidance on self-diagnosis.