[IronPython] Problem with KeyboardInterrupt by raw_input

B Kriszio b.Kriszio at gmx.de
Wed Nov 1 21:17:34 CET 2006


Hello IronPython people

I try to port a little read commands loop from C Python to IronPython

while 1:
    try:
        line = raw_input('>')
        if line == 'quit':
            break
        print line
    except KeyboardInterrupt:
        print 'Canceled'    

With CPython typing asdf and then ^C I get
 >asdf
Canceled
 >
trying the same with IronPython, I get
 >asdf
 >
and after some CR's following complete output is
 >asdf
 >
Canceled
Traceback (most recent call last):
  File C:\D\py\basics\cmdloop_1.py, line 16, in Initialize
KeyboardInterrupt:
Batchvorgang abbrechen (J/N)?

Any suggestions how I can use ^C to cancel some input and not my loop.

Thanks,
Bernd







More information about the Ironpython-users mailing list