manipulating child processes under Windows

Douglas Alan nessus at mit.edu
Mon Jun 3 21:13:13 EDT 2002


Hi.  I know lots about Python and lots about Unix, but unfortunately
I've been given the task of developing some software for Windows 2000,
and I'm having a problem.

The problem I'm having is this:  I want the Python script to run an
executable and then wait for the executable to terminate before
continuing.

Now, actually, I have no problem doing precisely this under Windows
2000 -- I know how to use wp.CreateProcess() to start up a program
under Python and wait for the program to terminate.  The problem I am
having is that the program itself is apparently just a stub that
spawns off the real program and then terminates, while the real
program then continues to run.  So my Python script ends up continuing
right away (because the stub process terminates right way), rather
than waiting for the real program to terminate.

So, I have two questions:

(1) Is this thing where a stub process fires off the real process a
    typical thing to do under Windows?  If so, it seems to make
    synchronizing processes difficult.

(2) What's the best way for me to solve the problem.  I.e., what's the
    best way to get my Python script to wait for the real program to
    terminate?

|>oug



More information about the Python-list mailing list