Answer the question
In order to leave comments, you need to log in
How to find out if a process is running in the task manager?
You need to find out if the process is running in the task manager, and therefore return either True or False.
I am using the psutil library. There is the following code:
proc_name = 'chrome.exe'
sucsesful = False
for proc in psutil.process_iter():
try:
if proc.name() == proc_name:
sucsesful = True
break
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
continue
if not sucsesful:
print("chrome hasn`t started")
else:
print('chrome started')
Answer the question
In order to leave comments, you need to log in
You are still iterating through all the processes, why not print their names? Surely there will be something similar, but slightly different fromchrome.exe
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question