Reputation: 13087
How to generate a KeyboardInterrupt in Windows?
while True:
try:
print 'running'
except KeyboardInterrupt:
break
I expected CTRL+C to stop this program but it doesn't work.
Upvotes: 0
Views: 5543
Reputation: 43096
Your code is working ok when ran into a windows console.
Ctrl+C generating a KeyboardInterrupt is a console feature. If you run it from a text editor like SciTE, it will not work.
Upvotes: 2