1

I usually use Matlab for processing results. However I'm required now to use Python. I want to set a breakpoint in a Python Jupyter notebook to go through functions. I was able to set up breakpoint but I can't actually go line by line debugging with this breakpoint. In Matlab I used to press F10 to do this.

1 Answer 1

2

In JupyterLab with the Xeus Python kernel (often tagged with 'XPython' when you are choosing the kernel) you can use the visual debugger. The run-next-line feature is the 'Next' button in the 'CALLSTACK' pane of the debugger panel. See the animation here for the 'Next' tooltip when hovering. And, although not featured in that animation, the tool tip actually shows 'Next (F10)' presently in my browser.

You can try it by clicking here. The session that spins up starts with a notebook open that has a nice introduction and guide to the features.

More can be found about the visual debugger here.


Current 'default' launches via MyBinder, have the Xeus Python kernel and the debugger available already. You can run the following code in a cell in any of those sessions to pull in the debugger demonstration notebook.

!curl -o debugger.ipynb https://raw.githubusercontent.com/jupyterlab/debugger/dfd6bf9d51a7a0cd78ca54f4173fcf527bd4d7fd/examples/index.ipynb

You'll find when you open it, that notebook also is set to trigger opening with the correct kernel necessary for debugging selected. Note that won't always be the first choice for when you start a new notebook.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi thNk you very much. I am not using jupyterlab rather jupyter notebook
To get the features you asked about, such as having an F10 key you can click to run next line, (for now) you need to use the modern JupyterLab interface. Abilities such as that or why it was developed. In the coming years the classic interface will actually have the same tech underlying, see here. For now you may want to try using the pdb module, with the step command, see docs.python.org/3/library/pdb.html and towardsdatascience.com/….

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.