瀏覽代碼

Fix execution under Python 3

Philipp Hagemeister 11 年之前
父節點
當前提交
e64eaaa97d
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      youtube_dl/utils.py

+ 2 - 1
youtube_dl/utils.py

@@ -1066,13 +1066,14 @@ def fix_xml_all_ampersand(xml_str):
 
 
 def setproctitle(title):
+    assert isinstance(title, type(u''))
     try:
         libc = ctypes.cdll.LoadLibrary("libc.so.6")
     except OSError:
         return
     title = title
     buf = ctypes.create_string_buffer(len(title) + 1)
-    buf.value = title
+    buf.value = title.encode('utf-8')
     try:
         libc.prctl(15, ctypes.byref(buf), 0, 0, 0)
     except AttributeError: