Hi

I am trying to write a PYTHON script that automates the running of an 
application program MX200510.EXE under XP Pro via a DOS window.  This file 
is in directory

C:\Program Files\CMG\IMEX\2005.10\EXE

The command line arguments are

MX200510.EXE -f "temp.dat" -wd "C:\Projects\Vitol\New 
business\Octon\simulation\full field model\0608"

My Python script is as follows:

#
# Test Python script to submit IMEX jobs
#

import os

#
# Start of MAIN program
#

# Initialisation

work_dir=r'C:\Projects\Vitol\New business\Octon\simulation\full field 
model\0608'
imex_dir=r'C:\Program Files\CMG\IMEX\2005.10\EXE'
imex_fil='"temp.dat"'

imex_args=('mx200510.exe','-f',imex_fil,'-wd','"'+work_dir+'"')

nscen=2

# Check IMEX directory and files exist

os.chdir(imex_dir)
L=os.listdir(imex_dir)

for item in L:
     print item

# Change directory to working directory

os.chdir(work_dir)

# Loop over N scenarios

for n in range(1,nscen):

     # Spawn IMEX job and wait for completion

     os.spawnv(os.P_WAIT, imex_dir, imex_args)

The output from this script is

ck9700.dll
libguide40.dll
mx200510.exe
mx200510en.chm
mx200510sp.chm

Traceback (most recent call last):
   File "C:/Projects/Vitol/New business/Octon/simulation/full field 
model/0608/test_imex.py", line 39, in -toplevel-
     os.spawnv(os.P_WAIT, imex_dir, imex_args)
OSError: [Errno 2] No such file or directory

I tried following the ARGS into the os module using the debugger but this 
did not help much, presumably because OS is precompiled.  Not sure which 
file or directory Python is unhappy about - LISTDIR shows that the EXE file 
and path exist so presumably it's something in the way I
set up the argument list.  All suggestions gratefully received!

Thanks

Alun Griffiths


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to