I wrote a python script but accidentally put an infinite while loop in my script.
How do I kill the process? I've tried ctrl+c
but with no success.
Are there any other option to try?
I'm on Mac Os X 10.7.2 with python 2.7
A process can be killed by calling the Process. terminate() function. The call will only terminate the target process, not child processes. The method is called on the multiprocessing.
You can also create a batch file called kill. bat with this command and place it in a folder that is seen as an eviromental variable so that you just can write the command kill to eliminate all the running threads of the python running scripts.
Type the command sudo pkill python to kill all the Python processes running, regardless of the user who started the process.
Try Ctrl+\
to send a SIGQUIT.
ps a
to get the PID of your process. kill -9 <pid>
to send it the unblockable SIGKILL signal.
Note that I only have a Linux box in front of me to test, so the OS X commands may be slightly different.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With