subprocess.wait() not waiting for Popen process to finish (when using threads)?

后端 未结 4 1096
悲&欢浪女
悲&欢浪女 2020-12-03 14:12

I am experiencing some problems when using subprocess.Popen() to spawn several instances of the same application from my python script using threads to have the

4条回答
  •  猫巷女王i
    2020-12-03 14:35

    I was having issues as well, but was inspired by yours.

    Mine looks like this, and works beautifully:

        startupinfo = subprocess.STARTUPINFO()
        startupinfo.dwFlags = subprocess.STARTF_USESHOWWINDOW
        startupinfo.wShowWindow = subprocess.SW_HIDE
        proc = subprocess.Popen(command, startupinfo=startupinfo)
        proc.communicate()
        proc.wait()
    

    Notice that this one hides the window as well.

提交回复
热议问题