Merge branch 'issue1017' of https://github.com/nicolargo/glances into issue1018

This commit is contained in:
Nicolargo 2017-02-08 16:18:21 +01:00
commit 5d15fe5feb
3 changed files with 6 additions and 7 deletions

View File

@ -19,7 +19,7 @@
"""Sensors plugin."""
from psutil import sensors_temperatures
import psutil
from glances.logger import logger
from glances.compat import iteritems
@ -219,13 +219,14 @@ class Plugin(GlancesPlugin):
class GlancesGrabSensors(object):
"""Get sensors stats using the py3sensors library."""
"""Get sensors stats."""
def __init__(self):
"""Init sensors stats."""
try:
sensors_temperatures()
except Exception:
# XXX: psutil>=5.1.0 is required
self.stemps = psutil.sensors_temperatures()
except AttributeError:
self.initok = False
else:
self.initok = True
@ -246,7 +247,7 @@ class GlancesGrabSensors(object):
return self.sensors_list
# Temperature sensor
for chipname, chip in iteritems(sensors_temperatures()):
for chipname, chip in iteritems(self.stemps):
i = 1
for feature in chip:
sensors_current = {}

View File

@ -21,4 +21,3 @@ scandir; python_version < "3.5"
statsd
wifi
zeroconf
https://bitbucket.org/gleb_zhulik/py3sensors/get/tip.zip

View File

@ -15,7 +15,6 @@ deps =
psutil
bottle
batinfo
https://bitbucket.org/gleb_zhulik/py3sensors/get/tip.tar.gz
commands =
python unitest.py
python unitest-restful.py