I'm debugging a program, and I would like it if Spyder could pause execution at an error. I had read previously that this can be done without breakpoints by just running scripts in Debug mode, but that isn't working for me.
Eg, when I run the following script in Debug mode in Spyder, it just errors out at the index out of range exception without giving me any opportunity in ipdb to play with the variables.
import numpy as np
A = np.random.randn(5)
A[7] = 8 #IndexError
More specifically, when I start debug, it starts me at the first line, then when I press Continue, execution proceeds all the way through line 3 without giving me a chance to inspect the workspace before execution exits.
Any thoughts?
Thanks.
I guess that if you launch your script under the "Run" > "Configuration per file" window and check "Directly enter debugging when errors appear" you get what you need. You should then run the script normally (not in debug mode).
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