From 5732a4bb27c2d7c11e8aa6a2bcd1fd9f5d921fb2 Mon Sep 17 00:00:00 2001 From: remittor Date: Tue, 23 Nov 2021 14:50:50 +0300 Subject: [PATCH] Fix backup mtd partition by number --- create_backup.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/create_backup.py b/create_backup.py index 6467a59..e643eb0 100644 --- a/create_backup.py +++ b/create_backup.py @@ -30,8 +30,12 @@ if len(sys.argv) > 1: print(" ") a_part = input("Enter partition name or mtd number: ") if a_part != 'a': - if isinstance(a_part, int): - p = a_part + try: + i_part = int(a_part) + except: + i_part = None + if i_part is not None: + p = i_part if p < 0 or p >= len(dev.partlist): die('Partition "mtd{}" not found!'.format(a_part)) else: