1
0
Fork 0
mirror of https://codeberg.org/polarisfm/youtube-dl.git synced 2024-12-28 10:36:50 +00:00

utils.py: Workaround TypeError with Python 2.7.13 in Windows

Fixes #11540

Tested with Windows Python 2.7.12 and 2.7.13.
This commit is contained in:
Ricardo Constantino 2017-02-10 21:05:09 +00:00
parent 9b92a5917b
commit 2f49bcd690
No known key found for this signature in database
GPG key ID: EFD16019AE4FF531

View file

@ -1684,6 +1684,11 @@ def setproctitle(title):
libc = ctypes.cdll.LoadLibrary('libc.so.6')
except OSError:
return
except TypeError:
# LoadLibrary in Windows Python 2.7.13 only expects
# a bytestring, but since unicode_literals turns
# every string into a unicode string, it fails.
return
title_bytes = title.encode('utf-8')
buf = ctypes.create_string_buffer(len(title_bytes))
buf.value = title_bytes