Efficient Python program debugging and Python program debugging
Now I can print the python program in debug for a while where possible errors occur. I wonder if python has one-step debugging tools like c ++'s IDE? Or how do python programmers debug their own python programs?
Should I have used IPython? Imagine how happy it is to automatically bring you to IPython Shell when an exception is thrown? In addition, unlike IPython, you can call commands such as p (print), up (up stack), and down (down stack. You can also create temporary variables and execute any function.
In fact, this can be implemented, and it is very simple, but you need to install IPython first. Save the following code as 'crash _ on_ipy.py'
Import sysclass ExceptionHook: instance = None def _ call _ (self, * args, ** kwargs): if self. instance is None: from IPython. core import ultratb self. instance = ultratb. formattedTB (mode = 'plain ', color_scheme = 'linux', call_pdb = 1) return self. instance (* args, ** kwargs) sys. export thook = ExceptionHook () # He asked hovertree.com
Then import crash_on_ipy somewhere in your project code.
This method does not require IDE.
Recommended: http://www.cnblogs.com/roucheng/p/pythonstring.html