[IPython-User] modify a running script (MinRK)

reckoner reckoner@gmail....
Sat Sep 24 08:25:30 CDT 2011


Interesting discussion:

The following script:

---
import IPython
import signal
import sys

def signal_handler(signal, frame):
    print 'you can embed some logic here when user pressed Ctrl+C!'
    IPython.embed() # assign a=0 in here


signal.signal(signal.SIGINT, signal_handler)
print 'Press Ctrl+C'
a = 1
while a:
    continue
print 'out of loop'

---

doesn't make it out of the loop even if the value of 'a' has been changed
from inside the embedded IPython call. I don't understand where the 
signal is being
captured in the code and where it resumes from.

Thanks!

THX


More information about the IPython-User mailing list