From b7fb364862c67187d879cdb694843d56ebd32d9c Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Mon, 18 Nov 2024 08:05:22 -0800 Subject: [PATCH] Meta: Avoid an IndexError with .get() instead of indexing in the weeknotes script Replace indexing into the os.environ dictionary with a .get() call (and a default) to avoid an IndexError --- scripts/weeknotes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/weeknotes b/scripts/weeknotes index 3354fe8..bb21523 100755 --- a/scripts/weeknotes +++ b/scripts/weeknotes @@ -39,7 +39,7 @@ def parse_args(argv, *a, **kw): ) edit_command.add_argument( '--editor', '-e', - default=os.environ['EDITOR'] or 'nvim', + default=os.environ.get('EDITOR', 'nvim'), ) edit_command.add_argument('--week', '-w') edit_command.set_defaults(handler=handle_edit_command)