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.
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.
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.