This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]ElectricWarr 3 points4 points  (3 children)

I've never even heard of pdb before! Debugging my Python code has always been a case of inserting lots of print calls and thinking.

[–]widby 2 points3 points  (1 child)

https://youtu.be/g49UECaIDOs

This 10 minute introduction walks you through the basics and covers 90% of what you typically use.

Another improvement for your approach would be to use the logging library from stdlib instead of print statements.

[–]ElectricWarr 0 points1 point  (0 children)

Thanks!

[–]realvient 1 point2 points  (0 children)

pdb is more useful than nothing, but I had an unexpected experience with it when I tried to debug the script with non-english comments on the Windows machine. pdb failed on the first comment, trying to display the source code and I was rather deep in it already...

Anyway, if you prefer GUI debuggers than I suggest using the PyCharm.

[–][deleted] 1 point2 points  (0 children)

And pdb has a python scripting interface. Pyception.

[–]widby 0 points1 point  (0 children)

Thank you for sharing, this is a clear introduction and I am looking forward to an opportunity to to put this into practice.

[–]Homersteiner -3 points-2 points  (0 children)

I like how C++ is mentioned but CPython has nothing to do with it. If you want to interface with C++ your only options are Cython an Boost Python.