IPython.core.debugger set_trace() does not work with ipywidgets events #10083

Open
handzsujt opened this Issue Dec 7, 2016 · 0 comments

Projects

None yet

1 participant

@handzsujt

Using

from IPython.core.debugger import Pdb
debugger = Pdb()
...
debugger.set_trace()

does not work if used within an event handler registered with on_click method from ipywidgets.widgets.Button in Jupyter/IPython notebook.

button = widgets.Button(description='Test')
def on_button_click(b):
    debugger.set_trace()
    for i in range(3):
        print(i)
button.on_click(on_button_click)
button

leads to output:

> <ipython-input-60-9375d14bcad9>(5)on_button_click()
      3 def on_button_click(b):
      4     debugger.set_trace()
----> 5     for i in range(3):
      6         print(i)
      7 

ipdb> 
0
1
2

without stopping at the ipdb prompt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment