Spent 90 minutes stuck on a bug because I read the error message wrong, then found a trick that fixed it in 2 minutes | Coding For Beginners - Freelance Forum - The Community for Independent Professionals
Spent 90 minutes stuck on a bug because I read the error message wrong, then found a trick that fixed it in 2 minutes
Two months into learning Python I hit a wall with a script that kept crashing on a list of names, and I just kept rewriting the logic over and over. I finally printed the raw error instead of skimming it and saw it was a type problem, one item in my list was a number not a string. My fix was dumb simple, I started printing the type of every variable right before the line that breaks, and the bug showed up in 2 minutes flat instead of 90. Doing that on purpose now every time something fails has saved me so much guessing, I don't even try to be smart about it anymore. Still working through a tutorial in my spare time here in Akron, so I'm wondering if there's a better way to catch this stuff before it breaks. What's your go-to move when a script crashes and the reason isn't obvious?