Reputation: 3823
What is the best way in python find the process name and owner?
Now i use WMI, but this version is too slow.
Upvotes: 0
Views: 344
Reputation: 13056
By using https://github.com/giampaolo/psutil:
>>> import psutil, os
>>> p = psutil.Process(os.getpid())
>>> p.name()
'python.exe'
>>> p.username()
'giampaolo'
>>>
Upvotes: 1
Reputation: 2289
Process name: is sys.argv[0] not sufficient for your purposes?
Upvotes: 0