From 0ba181c4a3e288a6ea244083a3d54d6f9d91e18e Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Mon, 4 Nov 2024 13:30:40 -0500 Subject: [PATCH] Transfer debug value more reliably --- src/py/kaleido/__init__.py | 4 +++- src/py/kaleido/scopes/plotly.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/py/kaleido/__init__.py b/src/py/kaleido/__init__.py index ba0cdb5..20afb0c 100644 --- a/src/py/kaleido/__init__.py +++ b/src/py/kaleido/__init__.py @@ -19,7 +19,9 @@ _scope_flags_ = ("plotlyjs", "mathjax", "topojson", "mapbox_access_token") -def to_image_block(spec, f=None, topojson=None, mapbox_token=None, debug=False): +def to_image_block(spec, f=None, topojson=None, mapbox_token=None, debug=None): + if debug is None: + debug = "KALEIDO-DEBUG" in os.environ try: _ = asyncio.get_running_loop() if debug: print("Got running loop, threading", file=sys.stderr) diff --git a/src/py/kaleido/scopes/plotly.py b/src/py/kaleido/scopes/plotly.py index bf3c6bb..f99f64e 100644 --- a/src/py/kaleido/scopes/plotly.py +++ b/src/py/kaleido/scopes/plotly.py @@ -28,7 +28,9 @@ class PlotlyScope(): _scope_flags = kaleido._scope_flags_ - def __init__(self, plotlyjs=None, mathjax=None, topojson=None, mapbox_access_token=None, debug=False, **kwargs): + def __init__(self, plotlyjs=None, mathjax=None, topojson=None, mapbox_access_token=None, debug=None, **kwargs): + if debug is None: + debug = "KALEIDO-DEBUG" in os.environ self.debug=debug # TODO: #2 This is deprecated, this whole FILE is deprecated self._plotlyjs = plotlyjs