mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
Merge pull request #12085 from wiiaboo/python2
utils.py: Workaround TypeError with Python 2.7.13 in Windows
This commit is contained in:
commit
f3915452de
1 changed files with 5 additions and 0 deletions
|
@ -1684,6 +1684,11 @@ def setproctitle(title):
|
||||||
libc = ctypes.cdll.LoadLibrary('libc.so.6')
|
libc = ctypes.cdll.LoadLibrary('libc.so.6')
|
||||||
except OSError:
|
except OSError:
|
||||||
return
|
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')
|
title_bytes = title.encode('utf-8')
|
||||||
buf = ctypes.create_string_buffer(len(title_bytes))
|
buf = ctypes.create_string_buffer(len(title_bytes))
|
||||||
buf.value = title_bytes
|
buf.value = title_bytes
|
||||||
|
|
Loading…
Reference in a new issue