Merge branch 'issue1055' into develop

This commit is contained in:
nicolargo 2017-03-15 21:16:46 +01:00
commit 8080ebab66

View File

@ -224,23 +224,28 @@ class GlancesGrabSensors(object):
def __init__(self):
"""Init sensors stats."""
# Temperatures
self.initok = False
self.stemps = {}
try:
# psutil>=5.1.0 is required
self.stemps = psutil.sensors_temperatures()
except AttributeError:
logger.warning("PsUtil 5.1.0 or higher is needed to grab temperatures sensors")
self.initok = False
self.stemps = {}
except OSError as e:
# FreeBSD: If oid 'hw.acpi.battery' not present, Glances wont start #1055
logger.error("Can not grab temperatures sensors ({})".format(e))
else:
self.initok = True
# Fans
self.sfans = {}
try:
# psutil>=5.2.0 is required
self.sfans = psutil.sensors_fans()
except AttributeError:
logger.warning("PsUtil 5.2.0 or higher is needed to grab fans sensors")
self.sfans = {}
except OSError as e:
logger.error("Can not grab fans sensors ({})".format(e))
# Init the stats
self.reset()