Skip to content

Commit

Permalink
Merge pull request #12085 from wiiaboo/python2
Browse files Browse the repository at this point in the history
utils.py: Workaround TypeError with Python 2.7.13 in Windows
  • Loading branch information
Yen Chi Hsuan authored Feb 11, 2017
2 parents 68c22c4 + 2f49bcd commit f391545
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions youtube_dl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f391545

Please sign in to comment.