From 53f2fab8f95d8da98007beb977c2b85fb88d2399 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Fri, 20 Sep 2024 11:39:55 +0200 Subject: Handle a missing yt_dlp module --- later | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/later b/later index a6ad804..12a6aa4 100755 --- a/later +++ b/later @@ -87,9 +87,12 @@ class TitleMap: return self.extract(key) def extract(self, key): - # Make painstakingly sure that we only do this when absolutely - # necessary: importing yt_dlp is noticeably slow :( - import yt_dlp + try: + # Make painstakingly sure that we only do this when absolutely + # necessary: importing yt_dlp is noticeably slow :( + import yt_dlp + except ModuleNotFoundError: + sys.exit("later: yt-dlp was requested, but yt_dlp python module not found") if not self.ytdl: self.ytdl = yt_dlp.YoutubeDL({"logger": YTDLPLogger()}) -- cgit v1.2.3-2-gb3c3