In Py3K - at least from "Python" 3.2 - subprocess.Popen and sys.argv
work consistently with (default unicode) str's on Windows.
CreateProcessW and GetCommandLineW are used obviously.
In Python - up to v2.7.2 at least - subprocess.Popen is buggy with
unicode arguments. It sticks to CreateProcessA (while os.* are
consistent with unicode). And shlex.split creates additional nonsense.
Pywin32's win32process.CreateProcess also doesn't auto-switch to the W
version, nor is there a win32process.CreateProcessW. Same with
GetCommandLine. Thus ctypes.windll.kernel32.CreateProcessW... needs to
be used. The subprocess module perhaps should be fixed regarding this
issue.
除非我完全弄错了,双反斜杠
导致问题。应该只有一个:
^{2}$否则,反斜杠将保留为反斜杠并留给}来处理。在
os.system()
,而不是{尝试使用UTF-8编码:
从答案here:
因此,
subprocess.Popen
无法在python2.x版本中处理unicode。在我的解决方案是将输入文件重命名为随机的(使用支持unicode的
os.rename
),用我用subprocess.Popen
启动的ffmpeg
进行转换,然后重新命名。在相关问题 更多 >
编程相关推荐