Skip to content

Commit 770dc94

Browse files
committed
Close #184: only call _repr_mimebundle_ if it exists and is callable
1 parent 92088db commit 770dc94

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [UNRELEASED]
99

10+
* Fixes 'AttributeError: object has no attribute "_repr_mimebundle_"'. (#184)
1011

1112
## [0.5.0] - 2025-01-29
1213

shinywidgets/_shinywidgets.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ def _open_shiny_comm():
125125
# Call _repr_mimebundle_() before get_state() since it may modify the widget
126126
# in an important way (unfortunately, it does for plotly)
127127
# # https://github.com/plotly/plotly.py/blob/0089f32/packages/python/plotly/plotly/basewidget.py#L734-L738
128-
w._repr_mimebundle_()
128+
if hasattr(w, "_repr_mimebundle_") and callable(w._repr_mimebundle_):
129+
w._repr_mimebundle_()
129130

130131
# Now, get the state
131132
state, buffer_paths, buffers = _remove_buffers(w.get_state())

0 commit comments

Comments
 (0)