KeyBoardInterrupt error 
Author Message
 KeyBoardInterrupt error

What can trigger a Keyboard Interrupt?

I need Ctrl-C to be ignored and Ctrl-D to map to a function.

gettting a single char at a time is a bad idea for my project

--
Jason Straw

Yorktown High School Linux Users' Group Meetings Coordinator / yhslug.tux.org
What do IBM, $1,000,000,000 and Linux have to do with each other?
Find out April 20th in Arlington, VA at the Yorktown High School Linux Users' Group



Mon, 15 Sep 2003 03:00:28 GMT  
 KeyBoardInterrupt error

Quote:

> What can trigger a Keyboard Interrupt?
>>> raise KeyboardInterrupt

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
KeyboardInterrupt

--
Rikard Bosnjakovic - http://a214.ryd.student.liu.se/cv/ - ICQ: 1158217

Anyone sending unwanted advertising e-mail to my address will be
charged $250 for network traffic and computing time. By extracting my
address from this message or its header, you agree to these terms.



Mon, 15 Sep 2003 12:22:17 GMT  
 KeyBoardInterrupt error
Headers indicate evolution, so Linux, right?

Quote:

> What can trigger a Keyboard Interrupt?

Receiving a SIGINT.  The terminal driver will send one of those if you
hit Ctrl-C (by default).

Quote:
> I need Ctrl-C to be ignored and Ctrl-D to map to a function.

Two options for ignoring Ctrl-C: use termios to tuen off the ISIG
flag, along the lines of

import termios
import TERMIOS
n = termios.tcgetattr(0)
n[3] &=~ TERMIOS.ISIG
termios.tcsetattr(0, TERMIOS.TCSANOW, n)

but with some kind of error checking & stuff or use signal to ignore
SIGINTs:

signal.signal(signal.SIGINT,signal.SIG_IGN)

Note that when you're playing around at the console that readline
tends to reset both of these, which is nice, and that both of these
will leave ^C in the input stream (it seems).

Ctrl-D just causes reads to abort early.  If you're using raw_input()
(a) don't, if you want this level of control (b) just catch EOFErrors
and restart your loop.

Quote:
> gettting a single char at a time is a bad idea for my project

Eh?  How does this relate to the above?

If you're interested in line input, you *might* want to look at my
python line reader, which was tentatively dubbed "pyrl", but needs a
new name ("pyrl" is taken).  It's not really finished; find it at:

  http://www-jcsu.jesus.cam.ac.uk/~mwh21/hacks/pyrl-0.2.0.tar.gz

To test drive, unpack & go:

$ python python_reader.py

(requires Python 2).

I've almost got incremental history searching done on my hard drive,
but a few bugs and some additional commitments have stalled me...
Anybody interested in seeing more, or have a better name than
pyttyinput?

Cheers,
M.

--
  I'll write on my monitor fifty times 'I must not post self-indulgent
  wibble nobody is interested in to ucam.chat just because I'm bored
  and I can't find the bug I'm supposed to fix'.
                                            -- Steve Kitson, ucam.chat



Tue, 16 Sep 2003 06:22:05 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. KeyboardInterrupt errors in ASP pages

2. ASP KeyboardInterrupt errors

3. KeyboardInterrupt errors in ASP pages

4. Python ActiveX Scripting Engine (0x80020009) Error - KeyboardInterrupt - python 2.2

5. Ctrl-C, raw_input, the cmd module, and KeyboardInterrupt

6. KeyboardInterrupt

7. Python, ASP/IIS, KeyboardInterrupt

8. KeyboardInterrupt in IIS?

9. KeyboardInterrupt exception in ASP pages.

10. KeyboardInterrupt in ASP

11. intermittant KeyboardInterrupt on Linux

12. KeyboardInterrupt in ASP

 

 
Powered by phpBB® Forum Software