vim and python scripts debugging


Question

Are there any ways to debug python scripts not leaving vim in *nix systems (executing the script, setting up breakpoints, showing variables in watch-list, etc)?

1
33
9/25/2011 1:39:27 AM

Accepted Answer

Use pdb:

import pdb
def main():
  list = [1,2,3]
  pdb.set_trace()
  list = [2,3,4]

if __name__ == '__main__':
    main()

Now run using :!python % and you'll hit your breakpoint and be able to debug interactively like in gdb.

36
6/3/2013 4:08:46 PM

Try pyclewn. It allows to use vim as front end for pdb. You can create/delete break points, control flow of debugging process, look at values of your variables. All from vim!


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon