Merge branch 'radiojavan' of https://github.com/mtp1376/youtube-dl into mtp1376-radio...
[youtube-dl] / youtube_dl / options.py
index 4e6e47d6fdc430f4071c1470f25a1b7377ad7845..8e80e3759410ed18afa3a1c432c53e0785d90b51 100644 (file)
@@ -13,6 +13,7 @@ from .compat import (
     compat_kwargs,
 )
 from .utils import (
+    preferredencoding,
     write_string,
 )
 from .version import __version__
@@ -794,6 +795,11 @@ def parseOpts(overrideArguments=None):
             write_string('[debug] Override config: ' + repr(overrideArguments) + '\n')
     else:
         command_line_conf = sys.argv[1:]
+        # Workaround for Python 2.x, where argv is a byte list
+        if sys.version_info < (3,):
+            command_line_conf = [
+                a.decode(preferredencoding(), 'replace') for a in command_line_conf]
+
         if '--ignore-config' in command_line_conf:
             system_conf = []
             user_conf = []