Edward Elliott wrote: > Serge Orlov wrote: > > I. Myself wrote: > >> Suppose it is supposed to run for one minute, but it just keeps going > >> and going. Does Python have any way to kill it? > > > > On linux it's pretty easy to do, just setup alarm signal. On windows > > it's not so trivial to the point you cannot do it using python.org > > distribution, you will need to poke in low level C API using win32 > > Can't you use a Timer thread and then send the runaway process a signal? > Does Windows not have the equivalent of SIGHUP/SIGTERM/SIGKILL?
Windows doesn't have signals, so os.kill (that should rather be called os.send_signal) is not implemented on Windows. Perhaps os module should have os.terminate(pid) that can be implemented on Windows. You're right about timer thread, it's better, I didn't think of it because of my lack of experience with threading module. The watchdog process code in my second post is almost useless: it's complicated and os.kill is not available on windows anyway :-( Time to rest. -- http://mail.python.org/mailman/listinfo/python-list