Search code examples
pythonjupyter-notebookipywidgets

AttributeError: type Object 'Widget' has no attribute '_ipython_display_'


In one of my python test case I have mockcomm object and in the mockcomm function I am using ipywidgets. Recently Upgraded ipywidgets version from 7 to 8. The code is working fine in version 7 of ipywidgets but when upgraded I am facing the below error. Saying Object has not attribute defined. did any one faced the error can help me.

enter image description here


Solution

  • According to this issue, from ipywidgets 8, widgets uses _repr_mimebundle_ instead of _ipython_display_.

    So _widget_attrs['_ipython_display_'] will raise KeyError. Use _repr_mimebundle_ as key will sovle problem.