aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorWolfgang Müller2024-09-20 11:39:55 +0200
committerWolfgang Müller2024-09-22 19:40:03 +0200
commit53f2fab8f95d8da98007beb977c2b85fb88d2399 (patch)
treea594cd37084e16c2bc7362d67e7e35fcb19b734c
parent79b22d8e4c900c8b8ea7c6fbda7c07493cbb5793 (diff)
downloadlater-53f2fab8f95d8da98007beb977c2b85fb88d2399.tar.gz
Handle a missing yt_dlp module
-rwxr-xr-xlater9
1 files 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()})