I've got a script that's been running for days and is about halfway done. It's got a stupid bug in it which is going to cause it to crash before it finishes if a certain counter gets too high (the counter is otherwise unused; I don't mind mangling it to keep the script going). I did not have the foresight to import a module or write a backdoor to let me change state in any way; I've been told I can still get at the counter using gdb.
For simplicity, imagine instead I'm talking about this script below, which I have run from the command line as "python foo.py"
from time import sleep
i = 0
while(True):
i += 1
if (i > 100):
raise Exception("Explosion")
sleep(10)
What exactly would I need to type in gdb from time to time to change the value of the variable i to 0, and avoid the explosion? (If it matters, my python binary is 2.7.3).