Debugging on python 2.7

hello, world class developers ##
someone tell me about , how to debug my python code when it crash by using an optimum way of debugging to do that ,

In my classes my students use PyCharm, a wonderful IDE from JetBrains. I have linked to the education version, there is also a free community version. I encourage my students to register for a free student JetBrains account and make use of the full version because of the wonderful GitHub integration.

PyCharm allows them to easily debug their code setting breakpoints and evaluating variables and expressions.

thank you so much,

Alternatively, you can use the native python module pdb.
By placing a call to the function pdb.set_trace(), you can set a breakpoint in your code and spawn a python interpreter when the breakpoint is reached.

1 Like

This is what I use on a daily basis as well for debugging python code.

import pdb; pdb.set_trace()

also, please consider swapping to python3 as teaching/learning python2 would not be as rewarding as python3, due to the fact that python2 is being deprecated in favor of python3:

thank you so much!"