From 7b861a42f575525e817cecd9bf309c881f2c5c3d Mon Sep 17 00:00:00 2001 From: Patrick Braune Date: Tue, 2 Feb 2021 08:39:38 +0100 Subject: [PATCH] read file in binary and replace encoding errors --- i3pystatus/battery.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i3pystatus/battery.py b/i3pystatus/battery.py index 15830f3..20e80e3 100644 --- a/i3pystatus/battery.py +++ b/i3pystatus/battery.py @@ -13,8 +13,8 @@ class UEventParser(configparser.ConfigParser): @staticmethod def parse_file(file): parser = UEventParser() - with open(file, "r") as file: - parser.read_string(file.read()) + with open(file, "rb") as file: + parser.read_string(file.read().decode(errors="replace")) return dict(parser.items("id10t")) def __init__(self):