From c0fddcefc59d5b3772e9de34f222e8b839914154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 8 Feb 2022 19:30:29 +0100 Subject: [PATCH] [downloader:ytdl] make ImportErrors non-fatal (#2273) --- gallery_dl/downloader/ytdl.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gallery_dl/downloader/ytdl.py b/gallery_dl/downloader/ytdl.py index 30f628ef..462bbf8f 100644 --- a/gallery_dl/downloader/ytdl.py +++ b/gallery_dl/downloader/ytdl.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2018-2021 Mike Fährmann +# Copyright 2018-2022 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -39,7 +39,13 @@ class YoutubeDLDownloader(DownloaderBase): if not ytdl_instance: ytdl_instance = self.ytdl_instance if not ytdl_instance: - module = ytdl.import_module(self.config("module")) + try: + module = ytdl.import_module(self.config("module")) + except ImportError as exc: + self.log.error("Cannot import module '%s'", exc.name) + self.log.debug("", exc_info=True) + self.download = lambda u, p: False + return False self.ytdl_instance = ytdl_instance = ytdl.construct_YoutubeDL( module, self, self.ytdl_opts) if self.outtmpl == "default":