On Fri, Mar 24, 2017 at 2:09 PM, Chris Angelico <ros...@gmail.com> wrote: > On Sat, Mar 25, 2017 at 6:55 AM, adam.c.bernier <adam.c.bern...@kp.org> wrote: >> On Friday, March 24, 2017 at 12:55:30 PM UTC-7, adam.c.bernier wrote: >>> On Friday, March 24, 2017 at 12:51:02 PM UTC-7, Chris Angelico wrote: >>> > On Sat, Mar 25, 2017 at 6:40 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: >>> > > If that's what's happening it would be a bug. Are you sure that the >>> > > other program isn't simply crashing or otherwise failing to complete? >>> > > >>> > >>> > Or possibly is running asynchronously. Is this a GUI app? A lot of >>> > Windows GUI programs don't wait when you invoke them. >>> > >>> > ChrisA >>> >>> Aha! Since the Excel app is a GUI app it's not waiting is that right? >> >> If that's the case is there any workaround? > > Errr.... been a while since I messed with Windows.... from memory, I > think you can "start /wait programname" to make it wait?? Worth a try, > at least.
start /wait is for batch scripts, specifically because by default start doesn't wait on GUI programs. I'm pretty sure that WaitForSingleObject (which Popen.wait uses) is perfectly capable of waiting on GUI programs (I would even bet dollars for donuts that this is exactly what start /wait does). Another possibility is that the subprocess itself is creating its own subprocesses and not waiting on them. If it terminates before its children, the wait() call will finish even though work is still being done. -- https://mail.python.org/mailman/listinfo/python-list