process_name = "CCC.exe"
for proc in psutil.process_iter():
if proc.name == process_name:
print ("have")
else:
print ("Dont have")
I know for the fact that CCC.exe is running. I tried this code with both 2.7 and 3.4 python I have imported psutil as well. However the process is there but it is printing "Dont have".
name
is a method of proc
:
process_name = "CCC.exe"
for proc in psutil.process_iter():
if proc.name() == process_name:
print ("have")
else:
print ("Dont have")