您的位置:首页 > 产品设计 > UI/UE

windows上subprocess.Popen的参数close_fds=True与stdin/stdout/stderr不能共存

2017-03-21 21:53 537 查看
运行命令

subprocess.Popen(cmd, close_fds=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)


出现错误

ValueError: close_fds is not supported on Windows platforms if you redirect stdin/stdout/stderr


原因

在windows上subprocess.Popen的参数close_fds=True与stdin/stdout/stderr不能共存


close_fds=True表示子进程将不会继承父进程的输入、输出、错误管道。

windows上不能将close_fds设置为True同时重定向子进程的标准输入、输出与错误(stdin, stdout, stderr)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  subprocess