1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-12-24 15:27:55 +01:00

Fix platform name in Python 2 with --verbose (Closes #1228)

This commit is contained in:
Philipp Hagemeister 2013-08-28 12:57:10 +02:00
parent ce6a696e4d
commit c496ca96e7
2 changed files with 16 additions and 4 deletions

View File

@ -45,6 +45,7 @@ import sys
import warnings
import platform
from .utils import *
from .update import update_self
from .version import __version__
@ -611,7 +612,7 @@ def _real_main(argv=None):
sys.exc_clear()
except:
pass
sys.stderr.write(u'[debug] Python version %s - %s' %(platform.python_version(), platform.platform()) + u'\n')
sys.stderr.write(u'[debug] Python version %s - %s' %(platform.python_version(), platform_name()) + u'\n')
sys.stderr.write(u'[debug] Proxy map: ' + str(proxy_handler.proxies) + u'\n')
ydl.add_default_info_extractors()

View File

@ -1,19 +1,20 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import email.utils
import errno
import gzip
import io
import json
import locale
import os
import platform
import re
import socket
import sys
import traceback
import zlib
import email.utils
import socket
import datetime
try:
import urllib.request as compat_urllib_request
@ -732,3 +733,13 @@ class DateRange(object):
return self.start <= date <= self.end
def __str__(self):
return '%s - %s' % ( self.start.isoformat(), self.end.isoformat())
def platform_name():
""" Returns the platform name as a compat_str """
res = platform.platform()
if isinstance(res, bytes):
res = res.decode(preferredencoding())
assert isinstance(res, compat_str)
return res