killing own process in windows

Christian Heimes lists at cheimes.de
Sun Mar 7 17:36:54 EST 2010


News123 wrote:
> Hi,
> 
> 
> How can I kill my own process?
> 
> Some multithreaded programs, that I have are unable to stop when ctrl-C
> is pressed.
> Some can't be stopped with sys.exit()

You have to terminate the XMP-RPC server or the manager first. Check the
docs!

You can terminate a Python process with os._exit() but I recommend that
you find another way. os._exit() is a hard termination. It kills the
process without running any cleanup code like atexit handlers and
Python's internal cleanups. Open files aren't flushed to disk etc.

Christian




More information about the Python-list mailing list