Skip to content

Commit

Permalink
Close #184: only call _repr_mimebundle_ if it exists and is callable
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Jan 30, 2025
1 parent 92088db commit 770dc94
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion shinywidgets/_shinywidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 770dc94

Please sign in to comment.