Explorar o código

Fix UnicodeEncodeError with --write-info-json on Python 2.7 + Windows

Fixes #4244
Ivan Kozik %!s(int64=10) %!d(string=hai) anos
pai
achega
61ee5aeb73
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      youtube_dl/utils.py

+ 1 - 1
youtube_dl/utils.py

@@ -74,7 +74,7 @@ def write_json_file(obj, fn):
     """ Encode obj as JSON and write it to fn, atomically """
     """ Encode obj as JSON and write it to fn, atomically """
 
 
     fn = encodeFilename(fn)
     fn = encodeFilename(fn)
-    if sys.version_info < (3, 0):
+    if sys.version_info < (3, 0) and sys.platform != 'win32':
         encoding = get_filesystem_encoding()
         encoding = get_filesystem_encoding()
         # os.path.basename returns a bytes object, but NamedTemporaryFile
         # os.path.basename returns a bytes object, but NamedTemporaryFile
         # will fail if the filename contains non ascii characters unless we
         # will fail if the filename contains non ascii characters unless we