psutil.AccessDenied: psutil.AccessDenied (pid=1) #539

This commit is contained in:
nicolargo 2023-04-30 16:00:43 +02:00
parent 25efd90924
commit 59da647247
2 changed files with 6 additions and 5 deletions

View File

@ -294,12 +294,13 @@ def key_exist_value_not_none(k, d):
return k in d and d[k] is not None
def key_exist_value_not_none_not_v(k, d, v=''):
def key_exist_value_not_none_not_v(k, d, value='', lengh=None):
# Return True if:
# - key k exists
# - d[k] is not None
# - d[k] != v
return k in d and d[k] is not None and d[k] != v
# - d[k] != value
# - if lengh is not None and len(d[k]) >= lengh
return k in d and d[k] is not None and d[k] != value and (lengh is None or len(d[k]) >= lengh)
def disable(class_name, var):

View File

@ -222,7 +222,7 @@ class Plugin(GlancesPlugin):
def _get_process_curses_vms(self, p, selected, args):
"""Return process VMS curses"""
if key_exist_value_not_none_not_v('memory_info', p, ''):
if key_exist_value_not_none_not_v('memory_info', p, '', 1):
msg = self.layout_stat['virt'].format(self.auto_unit(p['memory_info'][1], low_precision=False))
ret = self.curse_add_line(msg, optional=True)
else:
@ -232,7 +232,7 @@ class Plugin(GlancesPlugin):
def _get_process_curses_rss(self, p, selected, args):
"""Return process RSS curses"""
if key_exist_value_not_none_not_v('memory_info', p, ''):
if key_exist_value_not_none_not_v('memory_info', p, '', 0):
msg = self.layout_stat['res'].format(self.auto_unit(p['memory_info'][0], low_precision=False))
ret = self.curse_add_line(msg, optional=True)
else: