From fd821e4f21232dbf5829775fcf85820969e19912 Mon Sep 17 00:00:00 2001 From: David Barnett Date: Thu, 3 Oct 2024 22:31:56 -0600 Subject: [PATCH] Fix `config edit` when missing dir blowing up with FileNotFoundError (#803) --- ChangeLog | 1 + gcalcli/cli.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 61791b8..4a0b383 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ v4.5.1 * Fix gcalcli failing to run on python 3.10 if config file is present + * Fix `config edit` when missing config dir blowing up with FileNotFoundError * Fix bizarre SSL recursion errors by moving truststore init earlier * Fix redundant "Ignore and refresh" prompt from `init` * Adjust "when" value parsing to handle YYYY-MM-DD consistently diff --git a/gcalcli/cli.py b/gcalcli/cli.py index f9fbfda..d1db09b 100755 --- a/gcalcli/cli.py +++ b/gcalcli/cli.py @@ -341,9 +341,10 @@ def main(): if parsed_args.subcommand == 'edit': printer.msg( f'Launching {utils.shorten_path(config_filepath)} in a ' - 'text editor...' + 'text editor...\n' ) if not config_filepath.exists(): + config_filepath.parent.mkdir(parents=True, exist_ok=True) with open(config_filepath, 'w') as f: f.write(EMPTY_CONFIG_TOML) utils.launch_editor(config_filepath)