aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/options.py
diff options
context:
space:
mode:
authorsepro <4618135+seproDev@users.noreply.github.com>2024-02-24 12:58:03 +0100
committerGitHub <noreply@github.com>2024-02-24 12:58:03 +0100
commit6a6cdcd1824a14e3b336332c8f31f65497b8c4b8 (patch)
tree8728443856cc8193725c94bdf1ad25b8128c7a05 /yt_dlp/options.py
parent998dffb5a2343ec709b3d6bbf2bf019649080239 (diff)
[core] Warn user when not launching through shell on Windows (#9250)
Authored by: seproDev, Grub4K Co-authored-by: Simon Sawicki <contact@grub4k.xyz>
Diffstat (limited to 'yt_dlp/options.py')
-rw-r--r--yt_dlp/options.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/yt_dlp/options.py b/yt_dlp/options.py
index ab4986515..14b030cfb 100644
--- a/yt_dlp/options.py
+++ b/yt_dlp/options.py
@@ -196,9 +196,12 @@ class _YoutubeDLOptionParser(optparse.OptionParser):
raise
return self.check_values(self.values, self.largs)
- def error(self, msg):
+ def _generate_error_message(self, msg):
msg = f'{self.get_prog_name()}: error: {str(msg).strip()}\n'
- raise optparse.OptParseError(f'{self.get_usage()}\n{msg}' if self.usage else msg)
+ return f'{self.get_usage()}\n{msg}' if self.usage else msg
+
+ def error(self, msg):
+ raise optparse.OptParseError(self._generate_error_message(msg))
def _get_args(self, args):
return sys.argv[1:] if args is None else list(args)