S
S
Sheud_z2021-08-25 14:15:36
Python
Sheud_z, 2021-08-25 14:15:36

How can I check if a process is a system process?

Let's say I have this code:

for proc in psutil.process_iter():
    try:
        processName = proc.name()
        processID = proc.pid
        print(processName , ' ::: ', processID)
    except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
        pass


How can I make it so that it does not display system processes?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-08-25
@Vindicar

By the user under whose name they are executed (proc.username())?
Or by the location of the executable file (proc.exe()).
It depends on how you define "system process".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question