From cfd1b7bd476dc0dcdc454b3f6af91d7e53ee2930 Mon Sep 17 00:00:00 2001 From: Hackintosh 5 Date: Sat, 8 Jun 2019 17:40:05 +0100 Subject: [PATCH] Derps --- idtconfig.py | 6 +++--- main.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/idtconfig.py b/idtconfig.py index 87cfd00..2163f76 100755 --- a/idtconfig.py +++ b/idtconfig.py @@ -14,7 +14,7 @@ def get_images(cfg: bytes): try: tree = etree.fromstring(cfg) except: - return get_simple(cfg.decode("utf-8")) + return get_simple(cfg) ddr_images = tree.xpath("(//configurations/configuration)[1]/bootloaderimage_ddr/image") std_images = tree.xpath("(//configurations/configuration)[1]/bootloaderimage/image") images = {int(img.get("address"), 0):img.text for img in ddr_images} @@ -27,10 +27,10 @@ def get_images(cfg: bytes): def get_simple(cfg): ret = {} - for line in cfg.readlines: + for line in cfg.split("\n"): match = re.fullmatch(r"(\w+)(?:\W+)(.+)") if not match: - return None + continue addr = int(match[1], 0) file = match[2] ret[addr] = file diff --git a/main.py b/main.py index 3fc97ad..7e69c7d 100755 --- a/main.py +++ b/main.py @@ -36,5 +36,5 @@ def main(config, device, chip=""): parser.add_argument("--device", "-d") parser.add_argument("config") args = parser.parse_args() - with open(args.config, "rb") as f: + with open(args.config, "r") as f: main(f, args.device if args.run else False)