diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-02-03 18:57:29 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-02-03 18:57:29 +0100 |
commit | ca01be5196ddb3879e924681934485f03f7f192b (patch) | |
tree | 9af91784be51195438dad79f65599c07f4485323 | |
parent | 44ca122c1c7fc131ad7f6587203a5d8d97a4bb30 (diff) | |
download | psutil-ca01be5196ddb3879e924681934485f03f7f192b.tar.gz |
#966: sensors_battery().power_plugged may erroneously return None on Python 3
-rw-r--r-- | HISTORY.rst | 2 | ||||
-rw-r--r-- | psutil/_pslinux.py | 2 |
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"): |