From 5c333d74969d7277a20e665b597fae20fc4d83a0 Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Fri, 13 Aug 2021 23:24:17 +0800 Subject: [PATCH] [lazy_extractor] Bugfix for when plugin directory doesn't exist (#691) Bug introduced by: 0b2e9d2c3051f2e1d79449adde3afbba3b5ec94f Authored by: kidonng --- devscripts/make_lazy_extractors.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/devscripts/make_lazy_extractors.py b/devscripts/make_lazy_extractors.py index f13262f76..6550244f2 100644 --- a/devscripts/make_lazy_extractors.py +++ b/devscripts/make_lazy_extractors.py @@ -16,12 +16,16 @@ if os.path.exists(lazy_extractors_filename): os.remove(lazy_extractors_filename) # Block plugins from loading -os.rename('ytdlp_plugins', 'ytdlp_plugins_blocked') +plugins_dirname = 'ytdlp_plugins' +plugins_blocked_dirname = 'ytdlp_plugins_blocked' +if os.path.exists(plugins_dirname): + os.rename(plugins_dirname, plugins_blocked_dirname) from yt_dlp.extractor import _ALL_CLASSES from yt_dlp.extractor.common import InfoExtractor, SearchInfoExtractor -os.rename('ytdlp_plugins_blocked', 'ytdlp_plugins') +if os.path.exists(plugins_blocked_dirname): + os.rename(plugins_blocked_dirname, plugins_dirname) with open('devscripts/lazy_load_template.py', 'rt') as f: module_template = f.read()