Python has a debugger , which is available as a module called pdb . It supports setting conditional breakpoints , stepping through the source code one line at a time, stack inspection, and more.
msg = "this is a test"
Insert pdb.set_trace() anywhere and it will function as a breakpoint . When you execute the script by python test.py, you will in the debug mode.
More on debug python: http://net-informations.com/python/iq/debug.htm