Debugging Python with pdb 🐞
Debugging can be quite messy and annoying but pdb helps out. pdb is an out-of-the-box fully featured Python console to make use of any Python command. If you have a standard script to debug simply use
Unfortunately this doesn't work for Python packages that you call via path variable, such as Instagram-Scraper. In this case either simply look for the respective file in your folder. For Instagram-Scraper on Ubuntu it would be:
Either put the following lines at the very beginning to start pdb right away or look for the lines you want to debug:
Save the file and execute as usual. When the code runs into bp() function you will get pdb console. Here Python oneliners come in handy!
Export string to file in one line
Otherwise just type
interact and you have a fully-featured Python console for statements over multiple lines. When finished, type
quit() and you get back to pdb.