`breakpoint` in a script does not invoke debugger in notebook

Greetings,

In python notebooks, I have used breakpoint in scripts to invoke the debugger within a notebook. However, something seems to have changed, and this is no longer the case.

A script such as shouldbreak.py containing the following:

def should_break():
    print('Before breakpoint')
    breakpoint()
    print('After breakpoint')

when run in a notebook, simply runs to completion:

In [1]: import shouldbreak
        shouldbreak.should_break()
Before breakpoint
After breakpoint

This is on MACOS Catalina, running Python 3.9.7 and notebook server 6.4.5

Thank you for posting. I believe that this is related to changes in ipykernel which enable the graphical debugger in JupyterLab (see `breakpoint()` not working but `import pdb; pdb.set_trace()` works as expected · Issue #10996 · jupyterlab/jupyterlab · GitHub) could you please open an issue on GitHub - ipython/ipykernel: IPython Kernel for Jupyter for that?

1 Like

Will do! Thanks for the reply!