I am new to Python. I am using the Python IDLE Debugger on Windows. Is there a way to inspect object attributes in the debugger? The debugger only shows object address/type.
A solution I tried was to create global variables and assign object attributes to them. The debugger then shows global variables. This works for mutable types such as list, but for immutable type such as int, it shows the value at assignment only. Is there a way to bind a global name to a global object's int attribute?
To execute a file in IDLE, simply press the F5 key on your keyboard. You can also select Run → Run Module from the menu bar. Either option will restart the Python interpreter and then run the code that you've written with a fresh interpreter.
The main interface to IDLE's debugger is the Debug Control window, or the Debug window for short. You can open the Debug window by selecting Debug→Debugger from the menu in the interactive window. Go ahead and open the Debug window.
Starting Python Debugger To start debugging within the program just insert import pdb, pdb. set_trace() commands. Run your script normally, and execution will stop where we have introduced a breakpoint. So basically we are hard coding a breakpoint on a line below where we call set_trace().
To close the loop on this, based on responses received:
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