[python-win32] win32process.CreateProcess - strange behavior

lueck at ipk-gatersleben.de lueck at ipk-gatersleben.de
Mon Apr 25 13:34:04 CEST 2011


I need to call an exe file (Windows XP) in my program. Up to now I used 
subprocess (Python 2.6):

cmd = "bowtie-build mydb.fasta my_db_index"
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE
subprocess.call(cmd, startupinfo=startupinfo)

Now I switched to Python 2.7 and also to win32process:

StartupInfo = win32process.STARTUPINFO()
StartupInfo.dwFlags = win32process.STARTF_USESHOWWINDOW
StartupInfo.wShowWindow = win32con.SW_HIDE   processHndl, 
primary_thread, pid, tid = win32process.CreateProcess(
cmd,                                None, None, 0,                      
         None, None, StartupInfo)

In generally it's works but with a very strange behavior. In my program 
I generate some data which are stored in text files and during the run 
proceeded. But If I use win32process, I see the results of the previous 
run in my output. If I start my program again and perform a new run 
with new data, the results are always calculated with the previous 
data. I do take care to delete data from the previous runs. I'm very 
confused how this can happen. If I use os.system(cmd) or subprocess as 
before, everything works as expected.

Can anybody can help?

Thanks in advance!

More information about the python-win32 mailing list