[IPython-user] Killing a hung program

Scott Kirkwood scottakirkwood at gmail.com
Fri Jul 1 17:35:55 CDT 2005

I did a little bit of experimenting with one of my programs. Trying to
turn on signal handling didn't really work
(signal.signal(signal.SIGINT, myBreak)), unless I'm outputting lots of
text then it'll work.  But if I'm hung and there's no text, Ctrl-C
doesn't work.

My thought is that you need to run the program in another thread and
then try sending signals to it. If the signals to stop doesn't work
you just kill the thread and hope for the best.


On 7/1/05, Joshua C Gilbert <jgilbert+lang at uvm.edu> wrote:
> On Thursday 16 June 2005 11:54 am, Fernando Perez wrote:
> > Scott Kirkwood wrote:
> > > I just started using IPython and it looks very interesting.
> > > But one little problem I have it that occassionally my program will hang
> > > or take a long time and I want to kill it.
> > > Unfortunately, under windows (W2K Professional) Ctrl-C doesn't work and
> > > Ctrl-Break kills the IPython shell as well.
> > > Can you trap Ctrl-Break in IPython and then send it to the currently
> > > running program instead?
> >
> > Well, despite appearances suggesting the contrary, ipython is not (nor
> > does it claim to be) a true system shell.  ipyhton is just a humble
> > python program, running under the Python runtime VM, with essentially no
> > signal handling capabilities.  Given that:
> >
> > 1. signal handling is one of the trickiest things to get right across
> > platforms (some say it's impossible to do it in a fully portable way)
> >
> > 2. I'm not in the business of competing with the real system shells
> > (bash, tcsh, etc.)
> >
> > I suspect these limitations will unfortunately remain in ipython.  If
> > someone has a lot of energy to sink into writing proper signal handling
> > into ipython's pysh profile, I'm not opposed to accepting patches for
> > it.  But it's not the avenue I'll follow with my own efforts in the
> > future, sorry.
> >
> > Regards,
> >
> > f
> The pysh profile is a system shell. Thus, you are competing with bash, for my
> usage at least.
> I'm interested in ipython becoming a very real competitor to bash (I hate
> tcsh). Can you list what you see as currently missing?
> I'm a Debian user. What is so non-portable about signal catching in Python?
> The standard library signal has always worked for me. What am I missing?
> >
> > _______________________________________________
> > IPython-user mailing list
> > IPython-user at scipy.net
> > http://scipy.net/mailman/listinfo/ipython-user

More information about the IPython-user mailing list