title: Python - A keyboard command to stop infinite loop?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4606942/why-cant-i-handle-a-keyboardinterrupt-in-python">Why can&#39;t I handle a KeyboardInterrupt in python?</a>  </p>
  </blockquote>
  
  
  
  <p>I was playing around with some Python code and created an infinite loop:</p>
  
  <pre><code>y = 0
  x = -4
  
  itersLeft = x
  while(itersLeft&lt;0):
      y = y + x
      itersLeft = itersLeft - 1
      print "y = ",y, "itersLeft = ", itersLeft
  
  print y
  </code></pre>
  
  <p>Is there a keyboard shortcut that would allow me to stop the looping - allowing me to fix the loop and then restart it?</p>
  
  <p>I've tried <kbd>Ctrl</kbd>+<kbd>C</kbd> and didn't have any luck.  If it helps I'm using a Windows 7 environment.  </p>
  
  <p>Thanks.</p>
  
  <p><strong>EDIT</strong></p>
  
  <hr>
  
  <p>I should have also mentioned that I'm using Aptana Studio 3 and attempted to run the <kbd>Ctrl</kbd>+<kbd>C</kbd> command within that.  It doesn't work there - but trying it within the regular console works fine.  I'm assuming it must be because of the Aptana environment.</p>