psutil can find process by name and kill it:
import psutil
PROCNAME = "python.exe"
for proc in psutil.process_iter():
# check whether the process name matches
if proc.name() == PROCNAME:
proc.kill()
More Related Contents:
- Run a process and kill it if it doesn’t end within one hour
- kill process with python
- How to start a background process in Python?
- What are the differences between the threading and multiprocessing modules?
- Check to see if python script is running
- List running processes on 64-bit Windows
- Sharing a complex object between processes?
- How to terminate process from Python using pid?
- Intercepting stdout of a subprocess while it is running
- Python: how to kill child process(es) when parent dies?
- subprocess: deleting child processes in Windows
- Is there a way to change effective process name in Python?
- How to check if there exists a process with a given pid in Python?
- How to add a timeout to a function in Python
- Keep a subprocess alive and keep giving it commands? Python
- What does ‘killed’ mean when processing a huge CSV with Python, which suddenly stops?
- How do I run another script in Python without waiting for it to finish? [duplicate]
- Ensuring subprocesses are dead on exiting Python program
- spawning process from python
- Determining running programs in Python
- Terminate a python script from another python script
- Simple Python Multiprocessing function in Spyder doesn’t output results
- Python: Getting a traceback from a multiprocessing.Process
- Using stdin in a child Process
- How to get the return value of a function passed to multiprocessing.Process?
- Execute .exe file embedded in Python script
- Real-time intercepting of stdout from another process in Python
- Killing child process when parent crashes in python
- Pausing a process?
- How to detect if a process is running using Python on Win and MAC