Interrupt an infinite loop in python script?

This thread should be helpful here: