From 71b448e39726d5352578e39e3a407e3fff9104f2 Mon Sep 17 00:00:00 2001 From: blob42 Date: Sat, 7 Jan 2023 12:10:28 +0100 Subject: [PATCH] fix check_update on non existing cached prompts --- cgpt.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cgpt.py b/cgpt.py index bf69c00..fa45a62 100755 --- a/cgpt.py +++ b/cgpt.py @@ -36,6 +36,9 @@ For example: `./cgpt.py pr | xclip -selection cliboard` CUSTOM_PROMPTS = os.path.join(XDG_DATA_HOME, "chatgpt-prompts", "my-prompts.csv") def check_update(): + if not os.path.exists(CACHE_LOCATION): + return + last_update = os.path.getmtime(CACHE_LOCATION) # if last update older than UPDATE_INTERVAL days if time.time() - last_update > UPDATE_INTERVAL * 24 * 60 * 60: