From 233ccc644846473e1c453946d924b24f374df19b Mon Sep 17 00:00:00 2001 From: "flyingscorpio@arch-desktop" Date: Fri, 22 May 2020 10:22:46 +0200 Subject: [PATCH] Define last_seen at the beginning, remove write for nothing in except statement --- dotfiles/i3/scripts/arch_linux_news/arch_linux_news | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dotfiles/i3/scripts/arch_linux_news/arch_linux_news b/dotfiles/i3/scripts/arch_linux_news/arch_linux_news index 31e17c0..1187fdb 100755 --- a/dotfiles/i3/scripts/arch_linux_news/arch_linux_news +++ b/dotfiles/i3/scripts/arch_linux_news/arch_linux_news @@ -15,12 +15,13 @@ def main() -> None: last_seen_file_path = os.path.expanduser("~/.cache/arch_linux_news_last_seen") + last_seen = "" + try: with open(last_seen_file_path, "r") as last_seen_file: last_seen = last_seen_file.read().strip() except FileNotFoundError: - with open(last_seen_file_path, "w") as last_seen_file: - last_seen_file.write("") + pass url = "https://www.archlinux.org/feeds/news/" feed = feedparser.parse(url)