Reputation: 12587
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
Upvotes: 17
Views: 68130
Reputation: 2444
try this.
pkill -9 python
or
ps -ef|grep python
kill -9 <pid>
or
lsof -i :port
or
sudo kill $(sudo lsof -t -i:8000)
Upvotes: 25
Reputation: 3329
Open Activity monitor, go to the Processes tab, and highlight python.exe and quit it by clicking Quit.
Upvotes: 1
Reputation: 3519
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.
Upvotes: 25