Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: plotly formatting error (#1633)

Myles Scolnick92b5297d10b6
diff --git a/marimo/_output/formatters/plotly_formatters.py b/marimo/_output/formatters/plotly_formatters.py
index f346b097fb..f7d3df79e2 100644
--- a/marimo/_output/formatters/plotly_formatters.py
+++ b/marimo/_output/formatters/plotly_formatters.py
@@ -34,11 +34,12 @@ class PlotlyFormatter(FormatterFactory):
import plotly.io as pio # type: ignore[import-not-found,import-untyped,unused-ignore] # noqa: E501
resolved_config: dict[str, Any] = {}
- try:
- default_renderer: Any = pio.renderers[pio.renderers.default]
- resolved_config = default_renderer.config or {}
- except AttributeError:
- pass
+ if pio.renderers.default:
+ try:
+ default_renderer: Any = pio.renderers[pio.renderers.default]
+ resolved_config = default_renderer.config or {}
+ except AttributeError:
+ pass
return Html(
build_stateless_plugin(