467,145 Members | 1,021 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,145 developers. It's quick & easy.

os.wait() for Windows

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/

Mar 20 '07 #1
  • viewed: 7574
Share:
1 Reply
On Mar 20, 10:32 am, "Damien Byrne" <damobyrne2...@hotmail.comwrote:
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

Mar 20 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Chang LI | last post: by
25 posts views Thread by BOOGIEMAN | last post: by
4 posts views Thread by GTi | last post: by
7 posts views Thread by Alex007 | last post: by
4 posts views Thread by Pierpaolo | last post: by
40 posts views Thread by =?Utf-8?B?Um9iZXJ0IEUuIEZsYWhlcnR5?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.