From 6dee06253216b8ebf0d2ebec6b3000c56950b21f Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Fri, 8 May 2026 17:15:17 +0200 Subject: [PATCH] exception handling --- radioPlayer.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/radioPlayer.py b/radioPlayer.py index e7f2245..a1adb5c 100644 --- a/radioPlayer.py +++ b/radioPlayer.py @@ -7,11 +7,13 @@ from threading import Lock def prefetch(path): if os.name == "posix": - with open(path, "rb") as f: - fd = f.fileno() - os.posix_fadvise(fd, 0, 0, os.POSIX_FADV_SEQUENTIAL) - os.posix_fadvise(fd, 0, 0, os.POSIX_FADV_NOREUSE) - os.posix_fadvise(fd, 0, 0, os.POSIX_FADV_WILLNEED) + try: + with open(path, "rb") as f: + fd = f.fileno() + os.posix_fadvise(fd, 0, 0, os.POSIX_FADV_SEQUENTIAL) + os.posix_fadvise(fd, 0, 0, os.POSIX_FADV_NOREUSE) + os.posix_fadvise(fd, 0, 0, os.POSIX_FADV_WILLNEED) + except Exception: pass MODULES_PACKAGE = "modules" MODULES_DIR = Path(__file__, "..", MODULES_PACKAGE).resolve()