I make web applications using Ruby on Rails as my backend. I use React and Flux on the frontend, which is JavaScript. I can fully use the debugging tools I need. I simply add the line of code "debugger" anywhere in my app, so that execution stops there. I use byebug gem in Rails. When the "debugger" line of code is executed on backend code, the debugging happens on the command line; when it happens in JavaScript code, the debugging happens in Chrome Dev Tools. In other words, I can work very quickly to debug.
What is the equivalent convenient debugging tool in Python? In other words, what should a person who can already program in general, and just wants to rapidly be able to debug in Python use? I am using Atom editor (like I use when I am making a web app).
You can use pdb
To add a breakpoint, insert:
import pdb; pdb.set_trace()
where you want to stop.
NB: Since python 3.7, you just can do
breakpoint()
In the debugger mode you can use the following commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With