Running scripts in python interactly with pdb
This week I need to run a script with lot of calls to an API. Would be nice to do some requests in the begining to validate the feature, and then keep it running.
With Python Debugger, pdb, is really easy for this case. Let’s see and example:
Suppose items has a size of 10k. If you run this script with pdb, it will drop a shell, so just press c, to continue:
But, if you want to stop it, without quiting, you can press CTRL+C, which will drop you in the pdb shell, where you can continue to the next iteration, print variables, or resume typping:
This functionality was very useful, since I can stop now the script and resume. Was even able to stop the execution, close the laptop, open in another network and resume the script.