Can I run a Python script step by step in Blender?
Launch blender from a terminal emulator.
Add import pdb; pdb.set_trace() to your code where you wish to start debugging from.
Run your code and you'll be put into the Python debugger, where you can use sEnter to step through the code.


See the pdb documentation for more info on usage. Also for the nicer ipython debugger (features syntax highlighting and tab completion), you can use ipdb.