My first example was basically just running the script until it crashed, conveniently having the problematic values assigned to the variables at the end of the run. From there, I could run lines individually outside of the functions that were crashing, and see where it hung up. This time, I’ll actually use the debugger. Amazingly, the script and input I’m working with give me occasion to address all of these cases.
A simple example of using the Python debugger (or the interactive version, which I prefer) is to open it however you prefer, and then add a break point somewhere useful. For instance, you might want to look at something before the whole script runs, so get into debugger mode and then just type…
b <line #>
…wherever you want it to stop. A break point can’t be at a blank line. Then, your script will halt with the variables at values you need.
Fun tip: if you want to iterate through a loop until you get to the value you want to examine, put your break point in the loop. Then, you can hit “c,” which will run the script until it encounters the break point. The first time through, it will go through the script and stop in the loop when it hits your break point. Subsequently hitting “c” will take you through another spin of the loop, and when e.g., you get to the value you want to examine, you can then step through it.
Alternatively, depending on your needs, you can just set the key value in the loop to the one you want to “fast forward” once all the data, etc. is loaded into the work space.