kill thread

Miki miki.tebeka at gmail.com
Thu Aug 7 23:49:20 EDT 2008


Hello,

> I have a threading.Thread class with a "for i in range(1,50)" loop
> within. When it runs and I do ^C, I have the error [1] as many as
> loops. I would like to catch this exception (and if possible do some
> cleanup like in C pthreads) so the program finishes cleanly. Where and
> how can I do this ? in __run__ ? __init__ ? a try/except stuff ?
You can have a try/except KeyboardException around the thread code.

HTH,
--
Miki <miki.tebeka at gmail.com>
http://pythonwise.blogspot.com



More information about the Python-list mailing list