From 92b8954b7063d481521a0d0066d4ea2b78bddef8 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Sat, 27 Feb 2021 13:16:42 -0500 Subject: [PATCH] Display kaleido installation instructions when neither kaleido nor orca are installed --- packages/python/plotly/plotly/io/_kaleido.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/python/plotly/plotly/io/_kaleido.py b/packages/python/plotly/plotly/io/_kaleido.py index 2e43239a70..043db05ade 100644 --- a/packages/python/plotly/plotly/io/_kaleido.py +++ b/packages/python/plotly/plotly/io/_kaleido.py @@ -92,9 +92,19 @@ def to_image( # ------------- if engine == "auto": if scope is not None: + # Default to kaleido if available engine = "kaleido" else: - engine = "orca" + # See if orca is available + from ._orca import validate_executable + + try: + validate_executable() + engine = "orca" + except: + # If orca not configured properly, make sure we display the error + # message advising the installation of kaleido + engine = "kaleido" if engine == "orca": # Fall back to legacy orca image export path