From bfccd4838ed6fe390bf34ef3e3efd342a169afbb Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Thu, 6 Feb 2020 13:28:09 -0600 Subject: [PATCH] Not all listed 'lead' sections still exist. --- ini-order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ini-order.py b/ini-order.py index 6ef7c690..fdb53fa9 100644 --- a/ini-order.py +++ b/ini-order.py @@ -61,7 +61,8 @@ with open(argv[1],"w", encoding="utf8") as outfile: kl = list(sections.keys()) kl.sort() for k in leadsects: - outfile.write("".join(sections[k])) + if k in sections: + outfile.write("".join(sections[k])) for k in kl: if k not in (leadsects + followsects):