calling python scripts as a sub-process
Catherine.M.Moroney at jpl.nasa.gov
Wed Nov 19 20:03:23 CET 2008
I have one script (Match1) that calls a Fortran executable as a
sub-process, and I want to write another script (Match4) that
spawns off several instances of Match1 in parallel and then waits
until they all finish running. The only way I can think of doing this
is to call it as a sub-process, rather than directly.
I'm able to get Match1 working correctly in isolation, using the
subprocess.Popen command, but calling an instance of Match1 as a
subprocess spawned from Match4 isn't working.
The command (stored as an array of strings) that I'm executing is:
['python ../src_python/Match1.py ',
'--block_start=62 ', '--block_end=62 ', '--istep=16 ', "--chmetric='M2'
", "--use_textid='true '"]
and I'm calling it as:
sub1 = subprocess.Popen(command)
I get the error below. Does anybody know what this error refers
to and what I'm doing wrong? Is it even allowable to call another
script as a sub-process rather than calling it directly?
File "../src_python/Match4.py", line 24, in RunMatch4
sub1 = subprocess.Popen(command1)
File "/usr/lib64/python2.5/subprocess.py", line 593, in __init__
File "/usr/lib64/python2.5/subprocess.py", line 1051, in _execute_child
OSError: [Errno 2] No such file or directory
Thanks for any help,
More information about the Python-list