LionHeart123 / pyscripter

Automatically exported from code.google.com/p/pyscripter
0 stars 0 forks source link

signal handler #548

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

the new features are really great!!

I saw that sys.exit() is now working as well (I think in  aprevious version it 
didn't work).

Is there a possibility to get the signal handler working as shown in the 
following script?

import signal
import time
import sys

def signal_handler(signal, frame):
    print "SIGINT received"
    sys.exit()

signal.signal(signal.SIGINT, signal_handler)

while True:
    time.sleep(1)
    print "hello"

This one behaves in the python console different to pyscripter.

Original issue reported on code.google.com by mproel...@googlemail.com on 17 Aug 2011 at 7:13

GoogleCodeExporter commented 9 years ago
Please read 
http://pyscripter.blogspot.com/2012/03/please-let-me-interrupt-you.html.  I run 
the above script with the forthcoming version of Python, pressed the Abort 
button (which is the equivalent to Ctrl+C in the python shell) and the output 
was:

>>> 
hello
hello
SIGINT received
>>> 

Original comment by pyscripter on 10 Mar 2012 at 2:03