From e0db765f8136a56bfabdff355c30394c193fb3c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Romeiras=20Amado?= Date: Sat, 11 Jun 2022 01:30:12 +0100 Subject: [PATCH] Fix JSON decode error. The JSON output from lsblk seems to have some issues that interfere with the `json.loads()` function. Specifically, the value 0B, which is expected to be a string. By doing a direct replace on the lsblk output for `0B` on `menu.py`, the JSON is parsed and the menu appears. --- menu.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/menu.py b/menu.py index 950bdf2..6135941 100644 --- a/menu.py +++ b/menu.py @@ -35,7 +35,8 @@ class ChoosePartition: def _read_partitions(self): r = subprocess.check_output(['lsblk', '--all', '--json', '-O']) - self.blkinfo = json.loads(r) + r = r.decode().replace('0B,', '\"0B\",') + self.blkinfo = json.loads(r.encode()) partn = 0 for bd in self.blkinfo['blockdevices']: if 'children' not in bd: