From ef8998c3698e3372154b8d396b4d80ac7bcb1c7f Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Mon, 19 Oct 2020 00:32:18 +0000 Subject: [PATCH] Suppress error if a monthly log file does not exist --- irclog.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/irclog.py b/irclog.py index 9fb309c..0b29280 100644 --- a/irclog.py +++ b/irclog.py @@ -889,9 +889,12 @@ class WebServer: def _file_iter_with_path(self, fn, path): # Open fn, iterate over its lines yielding (path, line) tuples - with open(fn, 'r') as fp: - for line in fp: - yield (path, line) + try: + with open(fn, 'r') as fp: + for line in fp: + yield (path, line) + except FileNotFoundError: + pass def _stdout_with_path(self, stdout): # Process grep output with --with-filenames, --null, and --line-number into (path, line) tuples.