Debugging

14 Apr 2020

A few situations in recent days have highlighted that I have a lot to learn yet about debugging. Happily, one situation resulted in lots of good learning that I think will smooth the debugging process for me overall, I think.

I was working on my password manager program, specifically on a function to encrypt a given file’s data. The function takes the data as a parameter, in the form of a list of lists. The data is output by the _readFile() function that is called before _encryptData()

At a certain point in writing the new function I wanted to check the output of the data variable from _readFile(). It was clear to me that I wanted to run the program, call the function and check the value of data but even after all the ways I’ve worked with debugging so far - using PyCharm’s debugging tools, the breakpoint() function, using print() statements - I wasn’t sure what was the best way to go about this.

I had a feeling that I should put a breakpoint in - but where? And how would I check the value of data? I asked for some help in understanding the principles at work here and learned the following:

While I know there’s many more tools & approaches to learn for debugging, these pointers were very helpful. I was able to check the output of the _readFile() function using a breakpoint, and continue on my way!