summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2018-03-13 18:34:49 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2018-03-13 18:34:49 +0100
commita16003453fdd1082550e61f12e04e1ae14e7d9fa (patch)
tree40ce9a0392721b28b82e4fa649cfc99b347703cd
parent006533d55316b6a9eb8004bd1b30acc3257fd15c (diff)
downloadpsutil-a16003453fdd1082550e61f12e04e1ae14e7d9fa.tar.gz
more detailed error msg in case of missing file when reading temperatures
-rw-r--r--psutil/_pslinux.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py
index a3653f98..b241710d 100644
--- a/psutil/_pslinux.py
+++ b/psutil/_pslinux.py
@@ -1140,9 +1140,10 @@ def sensors_temperatures():
for base in basenames:
try:
- current = float(cat(base + '_input')) / 1000.0
- unit_name = cat(os.path.join(os.path.dirname(base), 'name'),
- binary=False)
+ path = base + '_input'
+ current = float(cat(path)) / 1000.0
+ path = os.path.join(os.path.dirname(base), 'name')
+ unit_name = cat(path, binary=False)
except (IOError, OSError) as err:
# A lot of things can go wrong here, so let's just skip the
# whole entry.
@@ -1150,7 +1151,8 @@ def sensors_temperatures():
# https://github.com/giampaolo/psutil/issues/1101
# https://github.com/giampaolo/psutil/issues/1129
# https://github.com/giampaolo/psutil/issues/1245
- warnings.warn("ignoring %r" % err, RuntimeWarning)
+ warnings.warn("ignoring %r for file %r" % (err, path),
+ RuntimeWarning)
continue
high = cat(base + '_max', fallback=None)