I have a function as below which is working fine when I execute my python code in CMD (SIMT is an executable). However, when I built my executable with py2exe, a shell window quickly appear and disappear. So I searched and found out that I can use the subprocess.popen with creationflags= 0x08000000. But it does not work.
This is my function
def Kill(SIMT):
outfile1 = open('Kill.txt', 'w')
outfile1.write('Kill' + '\r\n')
outfile1.write('x')
outfile1.close()
os.system("type Kill.txt | testclient p . " + SIMT)
os.remove('Kill.txt')
and I replaced the os.system with:
subprocess.Popen(["type Kill.txt | testclient p . ", SIMT], creationflags= 0x08000000, shell=True).communicate()
Also, do I need to have the shell=True?