3
Rant: My first Python script crashed 3 times before lunch
I spent all Sunday building a little script to organize my music folder, and it froze my computer 3 times this morning. Turns out I had an infinite loop because I forgot to increment my counter variable. Anyone else have a dumb bug that took forever to find?
2 comments
Log in to join the discussion
Log In2 Comments
spencer6646d agoMost Upvoted
The print statement trick really is a lifesaver. I started doing that too but now I also add a small delay like time.sleep(0.1) inside loops that might run away, gives me time to hit Ctrl+C before my whole system locks up. Actually saved me last week when I accidently put a while True instead of a proper condition and my terminal filled up in seconds.
6
the_felix6d ago
Been there. Now I always put a print statement at the start of any loop so I can see what's actually happening. Saved me more times than I can count.
4