我有一个程序可以在 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