When I try to call get_screenshot_as_png(chart) with bokeh 1.3.4, I get this stack trace:
chartImage = get_screenshot_as_png(chart) File "/home/rotten/.virtualenvs/myvenv/lib/python3.7/site-packages/bokeh/io/export.py", line 217, in get_screenshot_as_png web_driver = driver if driver is not None else webdriver_control.get() File "/home/rotten/.virtualenvs/myvenv/lib/python3.7/site-packages/bokeh/io/webdriver.py", line 116, in get self.current = self.create() File "/home/rotten/.virtualenvs/myvenv/lib/python3.7/site-packages/bokeh/io/webdriver.py", line 121, in create return create_phantomjs_webdriver() File "/home/rotten/.virtualenvs/myvenv/lib/python3.7/site-packages/bokeh/io/webdriver.py", line 75, in create_phantomjs_webdriver phantomjs_path = detect_phantomjs() File "/home/rotten/.virtualenvs/myvenv/lib/python3.7/site-packages/bokeh/util/dependencies.py", line 117, in detect_phantomjs raise RuntimeError('Error encountered in PhantomJS detection: %r' % out.decode('utf8')) RuntimeError: Error encountered in PhantomJS detection: 'Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.\n'
I’ve tried setting QT_QPA_PLATFORM as an environment variable before running my python script. It did not help. I tried setting it to both “wayland” and to “offscreen”. I’m stumped as to what it is trying to tell me to do to work around the issue.
FWIW, I’m running Ubuntu 19.04 - Disco Dingo.
I can run export_png() without any problems, so for now I’ll export the chart to a file, and then read it back in with Image.open(). I’d love to be able to just go straight to an image object directly.