You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is something which comes up every now and then: an utility method which
returns an hashable dictionary containing all the process information.
Usually, the user of this method intends to collect all process info in one
shot and possibly pass the obtained data via json or similar data formats.
In general, this results in writing less and more-compact code since one
doesn't have to look for AccessDenied exception every time as in:
p = psutil.Process(pid)
try:
cwd = p.getcwd
except psutil.AccessDenied:
cwd = None
try:
ppid = p.ppid
except psutil.AccessDenied:
ppid = None
...vs:
p = psutil.Process(pid)
data = p.as_dict()
cwd = data['cwd']
ppid = data['ppid']
This is now committed in r1341 .
From g.rodola on June 10, 2012 23:59:25
Original issue: http://code.google.com/p/psutil/issues/detail?id=278
The text was updated successfully, but these errors were encountered: