From 36666f8cdf7e652c8bc299772e418c51811cd117 Mon Sep 17 00:00:00 2001 From: n9k Date: Mon, 13 Jun 2022 03:46:48 +0000 Subject: [PATCH] Catch all OSErrors when reading title.txt Previously we only caught FileNotFoundError. If there was a PermissionError for example, it would have percolated up and stopped some background tasks. --- anonstream/stream.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/anonstream/stream.py b/anonstream/stream.py index 5f88687..6f130c0 100644 --- a/anonstream/stream.py +++ b/anonstream/stream.py @@ -20,7 +20,8 @@ async def get_stream_title(): try: async with aiofiles.open(CONFIG['STREAM_TITLE']) as fp: title = await fp.read(8192) - except FileNotFoundError: + except OSError as e: + print(f'WARNING: could not read stream title: {e}') title = '' return title