Subprocess.popen.communicate() 不向文件传递命令

问题描述

我有一个程序可以在 RealityCapture 中打开并生成一个项目。我使用 subprocess.Popen() 将第一组命令传递给它,然后让项目保持打开状态并使用 subprocess.Popen.communicate() 传递其他命令。但是,当我使用通信()时,命令不会通过。我没有收到任何错误或任何信息,但命令无效。

command = [s.realityCaptureExePath,"create the new model","save the new model","export point cloud to show process is done",s.outputFolder + '\\' + "check_done_align.obj" #export point cloud to show that process is finished
               ]

    process = subprocess.Popen(command,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
    exist = os.path.exists(s.outputFolder + '\\' + "check_done_align.obj")

    while(exist == False): 
         ##check if point cloud is generated and sleeps until it is

##PROBLEM
new_command = "other set of commands"
process.communicate(bytes(new_command,encoding='utf-8')) ##this doesnt do anything

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)