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)?
Vim is a nice editor, but to do debugging I use a debugger (like GDB). But you don't have to use GDB in text mode; you can use a graphical frontend like KDbg, DDD or Insight. There are ways of getting GDB into Vim (but then you do get text based debugging). Show activity on this post.
In all programming exercises, it is difficult to go far and deep without a handy debugger. The built-in debugger, pdb , in Python is a mature and capable one that can help us a lot if you know how to use it. In this tutorial, we are going to see what the pdb can do for you as well as some of its alternatives.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With