in kif.py [0:0]
def getprocs():
procs = {}
for p in psutil.process_iter():
try:
pinfo = p.as_dict(attrs=['pid', 'name', 'username', 'status', 'cmdline'])
content = pinfo['cmdline']
if not content:
content = pinfo['name'] # Fall back if no cmdline present
pid = pinfo['pid']
if len(content) > 0 and len(content[0]) > 0:
content = [c for c in content if len(c) > 0]
procs[pid] = content
except (psutil.ZombieProcess, psutil.AccessDenied, psutil.NoSuchProcess):
print("Could not access process, it might have gone away...")
continue
return procs