diff --git a/gallery_dl/downloader/__init__.py b/gallery_dl/downloader/__init__.py index e0851ea7..6fb09e1b 100644 --- a/gallery_dl/downloader/__init__.py +++ b/gallery_dl/downloader/__init__.py @@ -30,9 +30,10 @@ def find(scheme): if scheme in modules: # prevent unwanted imports try: module = importlib.import_module("." + scheme, __package__) - klass = module.__downloader__ except ImportError: pass + else: + klass = module.__downloader__ if scheme == "http": _cache["http"] = _cache["https"] = klass diff --git a/gallery_dl/postprocessor/__init__.py b/gallery_dl/postprocessor/__init__.py index f38632dd..e63d4427 100644 --- a/gallery_dl/postprocessor/__init__.py +++ b/gallery_dl/postprocessor/__init__.py @@ -28,15 +28,18 @@ def find(name): try: return _cache[name] except KeyError: - klass = None + pass + + klass = None + if name in modules: # prevent unwanted imports try: - if name in modules: # prevent unwanted imports - module = importlib.import_module("." + name, __package__) - klass = module.__postprocessor__ - except (ImportError, AttributeError, TypeError): + module = importlib.import_module("." + name, __package__) + except ImportError: pass - _cache[name] = klass - return klass + else: + klass = module.__postprocessor__ + _cache[name] = klass + return klass # --------------------------------------------------------------------