0) Don't scrap it
1) Get some air
2) Backing out (commenting out)
3) Print everything
4) Don't cut and paste error messages into Google
5.0) Agan's rules
5.1) Quit thinking and look
It seems obvious that if you want to find a failure, you have to actually see the failure occur. In fact, if you don't see the failure, you won't even know it happened, right? Not true. What we see when we note the bug is the result of the failure: I turned on the switch and the light didn't come on. But what was the actual failure? Was it that the electricity couldn't get through the broken switch, or that it couldn't get through the broken bulb filament? (Or did I flip the wrong switch?) You have to look closely to see the failure in enough detail to debug it.
5.2) Check the plug
Question your assumptions. Are you running the right code? Are you out of gas? Is it plugged in?
You can find the book if you want more.Debugging is its own theoretical universe, but this is just a start. If your email-sending or image-editing Python scripts aren't working, don't despair. Take some deep breaths of outside air (specifically outside air) and know that this is a problem that you are capable of solving. Sometimes that's all it takes.Start at the beginning. Did you initialize memory properly? Did you squeeze the primer bulb? Did you turn it on?