os.wait() for Windows

kyosohma at gmail.com kyosohma at gmail.com
Tue Mar 20 11:59:22 EDT 2007


On Mar 20, 10:32 am, "Damien Byrne" <damobyrne2... at hotmail.com> wrote:
> Hello,
>
> I am new to python. I am using the os module to run a command in a
> bashshell. However I need this process to complete before continuing. Is
> there a command that will wait for this process to complete? I am using
> Windows XP and the os.wait() command only works for UNIX systems, and
> therefore doesn't work.
>
> My code is as follows:
>
> import os
> FileName = raw_input('Enter the file name: ')
> os.system('abaqus job=FileName')
> resultsFile = open('FileName.dat','r')
>
> Abaqus will take a few minutes to complete and create the associated results
> file. However once I run this code I get the following error ... "IOError:
> [Errno 2] No such file or directory: 'FileName.dat'" ... as the file does
> not exist yet. Is there any way of waiting for the job to complete before
> continuing?
>
> I'd appreciate any help.
>
> _________________________________________________________________
> Share folders without harming wildlife!http://www.communicationevolved.com/en-ie/


I would recommend subprocess.call(programToRun) or
subprocess.Popen(programToRun).wait()

Mike




More information about the Python-list mailing list