summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-02-03 18:57:29 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2017-02-03 18:57:29 +0100
commitca01be5196ddb3879e924681934485f03f7f192b (patch)
tree9af91784be51195438dad79f65599c07f4485323
parent44ca122c1c7fc131ad7f6587203a5d8d97a4bb30 (diff)
downloadpsutil-ca01be5196ddb3879e924681934485f03f7f192b.tar.gz
#966: sensors_battery().power_plugged may erroneously return None on Python 3
-rw-r--r--HISTORY.rst2
-rw-r--r--psutil/_pslinux.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index e5563348..403a2d7d 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -7,6 +7,8 @@
**Bug fixes**
+- 966_: [Linux] sensors_battery().power_plugged may erroneously return None on
+ Python 3.
- 968_: [Linux] disk_io_counters() raises TypeError on python 3.
- 970_: [Linux] sensors_battery()'s name and label fields on Python 3 are bytes
instead of str.
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py
index fdb48f96..beddb8b6 100644
--- a/psutil/_pslinux.py
+++ b/psutil/_pslinux.py
@@ -1153,7 +1153,7 @@ def sensors_battery():
os.path.join(POWER_SUPPLY_PATH, "AC0/online"),
fallback=b"0") == b"1"
elif os.path.exists(root + "/status"):
- status = cat(root + "/status", fallback="").lower()
+ status = cat(root + "/status", fallback="", binary=False).lower()
if status == "discharging":
power_plugged = False
elif status in ("charging", "full"):