The relevant part of the code is as follows:
pids = [] for size in SIZES: pids.append(os.spawnv(os.P_NOWAIT, RESIZECMD, [RESIZECMD, lotsOfOptions])) # Wait for all spawned imagemagick processes to finish while pids: (pid, status) = os.waitpid(0, 0) if pid: pids.remove(pid)
What this should do is discard all processes, and then wait for each process to complete before continuing. What he does is work for the most part, but sometimes crashes in the next section (when he expects all of these processes to be completed).
Is there something wrong with this? Is there a better way to do this?
The environment it should work with is CentOS with Python 2.4, but I am testing Cygwin with Python 2.5, so it may happen that it does not work on my machine, but will work on Linux (the Linux machine is very slow, and this error is rare, so I could not get it).
python linux process cygwin
Brendan long
source share