dugres
dugres

Reputation: 13087

KeyboardInterrupt in Windows?

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

Answers (1)

luc
luc

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

Related Questions