mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-11-04 00:25:15 +00:00 
			
		
		
		
	[options] Fix file based configurations for python 2 (Closes #5401)
This commit is contained in:
		@@ -794,21 +794,22 @@ def parseOpts(overrideArguments=None):
 | 
				
			|||||||
        if opts.verbose:
 | 
					        if opts.verbose:
 | 
				
			||||||
            write_string('[debug] Override config: ' + repr(overrideArguments) + '\n')
 | 
					            write_string('[debug] Override config: ' + repr(overrideArguments) + '\n')
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        command_line_conf = sys.argv[1:]
 | 
					        def compat_conf(conf):
 | 
				
			||||||
        # Workaround for Python 2.x, where argv is a byte list
 | 
					            if sys.version_info < (3,):
 | 
				
			||||||
        if sys.version_info < (3,):
 | 
					                return [a.decode(preferredencoding(), 'replace') for a in conf]
 | 
				
			||||||
            command_line_conf = [
 | 
					            return conf
 | 
				
			||||||
                a.decode(preferredencoding(), 'replace') for a in command_line_conf]
 | 
					
 | 
				
			||||||
 | 
					        command_line_conf = compat_conf(sys.argv[1:])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if '--ignore-config' in command_line_conf:
 | 
					        if '--ignore-config' in command_line_conf:
 | 
				
			||||||
            system_conf = []
 | 
					            system_conf = []
 | 
				
			||||||
            user_conf = []
 | 
					            user_conf = []
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            system_conf = _readOptions('/etc/youtube-dl.conf')
 | 
					            system_conf = compat_conf(_readOptions('/etc/youtube-dl.conf'))
 | 
				
			||||||
            if '--ignore-config' in system_conf:
 | 
					            if '--ignore-config' in system_conf:
 | 
				
			||||||
                user_conf = []
 | 
					                user_conf = []
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                user_conf = _readUserConf()
 | 
					                user_conf = compat_conf(_readUserConf())
 | 
				
			||||||
        argv = system_conf + user_conf + command_line_conf
 | 
					        argv = system_conf + user_conf + command_line_conf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        opts, args = parser.parse_args(argv)
 | 
					        opts, args = parser.parse_args(argv)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user