del behavior 2

Marc 'BlackJack' Rintsch bj_666 at
Wed Jan 7 22:30:52 CET 2009

On Wed, 07 Jan 2009 12:03:36 -0800, Eric Snow wrote:

> Thanks for the responses.  What I mean is when a python process is
> interrupted and does not get a chance to clean everything up then what
> is a good way to do so?

Well, if it doesn't get a chance then it doesn't get a chance.  ;-)

> For instance, I have a script that uses child
> ptys to facilitate ssh connections (I'm using pxssh).  When I ^C the
> python process I am left with the child processes running and the ssh
> connections open.  Naturally I run out of ttys if this happens too much,
> which I have had happen.  So if python does not get a chance to take
> care of those, what is a good way to do so?  Does a try/finally or a
> with statement address that?  Thanks!

If you clean up the mess in the ``finally`` branch: yes.  <Ctrl>+<C> 
raises a `KeyboardInterrupt`.

	Marc 'BlackJack' Rintsch

More information about the Python-list mailing list