diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e729a9..801f7ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [UNRELEASED] +* Fixes 'AttributeError: object has no attribute "_repr_mimebundle_"'. (#184) ## [0.5.0] - 2025-01-29 diff --git a/shinywidgets/_shinywidgets.py b/shinywidgets/_shinywidgets.py index 51fe713..6bc64c6 100644 --- a/shinywidgets/_shinywidgets.py +++ b/shinywidgets/_shinywidgets.py @@ -125,7 +125,8 @@ def _open_shiny_comm(): # Call _repr_mimebundle_() before get_state() since it may modify the widget # in an important way (unfortunately, it does for plotly) # # https://github.com/plotly/plotly.py/blob/0089f32/packages/python/plotly/plotly/basewidget.py#L734-L738 - w._repr_mimebundle_() + if hasattr(w, "_repr_mimebundle_") and callable(w._repr_mimebundle_): + w._repr_mimebundle_() # Now, get the state state, buffer_paths, buffers = _remove_buffers(w.get_state())