From cef35eb23d9c1013a9c59744c31e2f4d6a40b5c7 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sun, 27 Mar 2016 18:46:11 +0200 Subject: [PATCH] Crash on launch when viewing temperature of laptop HDD in sleep mode #824 --- NEWS | 4 +++- glances/plugins/glances_hddtemp.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index faf9bebe..ddefe38d 100644 --- a/NEWS +++ b/NEWS @@ -5,7 +5,9 @@ Glances Version 2 Version 2.7 =========== - * ... +Bugs corrected: + + * Crash on launch when viewing temperature of laptop HDD in sleep mode (issue #824) Version 2.6.1 ============= diff --git a/glances/plugins/glances_hddtemp.py b/glances/plugins/glances_hddtemp.py index 8a1347c4..9c117497 100644 --- a/glances/plugins/glances_hddtemp.py +++ b/glances/plugins/glances_hddtemp.py @@ -21,6 +21,7 @@ import os import socket +import numbers from glances.compat import nativestr, range from glances.logger import logger @@ -119,7 +120,8 @@ class GlancesGrabHDDTemp(object): temperature = fields[offset + 3] unit = nativestr(fields[offset + 4]) hddtemp_current['label'] = device - hddtemp_current['value'] = float(temperature) if temperature != b'ERR' else temperature + # Temperature could be 'ERR' or 'SLP' (see issue#824) + hddtemp_current['value'] = float(temperature) if isinstance(temperature, numbers.Number) else temperature hddtemp_current['unit'] = unit self.hddtemp_list.append(hddtemp_current)