calling python scripts as a sub-process
Catherine Moroney
Catherine.M.Moroney at jpl.nasa.gov
Wed Nov 19 14:30:10 EST 2008
I just tried that, and I get the same error.
Interestingly enough, a shorter (and incorrect) version
of the command works well enough so that it gets into the
Match1 code and does the argument check there.
The following code gets into Match1:
>>> command = ['python', '../src_python/Match1.py','--filex="xyz"']
>>> sub1 = subprocess.Popen(command)
whereas this doesn't even get to call Match1:
command =
['python','/data/svn_workspace/cmm/sieglind/USC/EE569/tpaper/test/../src_python/Match1.py
', '--file_ref=MISR_AM1_GRP_ELLIPSOID_GM_P228_O003571_BF_F03_0024.hdf ',
'--file_cmp=MISR_AM1_GRP_ELLIPSOID_GM_P228_O003571_DF_F03_0024.hdf ',
'--block_start=62 ', '--block_end=62 ', '--istep=16 ', '--chmetric=M2 ',
'--use_textid=true']
sub1 = subprocess.Popen(command)
Can anybody see a reason for why the abbreviated version works, and
the full-up one doesn't?
Catherine
Philip Semanchuk wrote:
>
> On Nov 19, 2008, at 2:03 PM, Catherine Moroney wrote:
>
>> The command (stored as an array of strings) that I'm executing is:
>>
>> ['python ../src_python/Match1.py ',
>> '--file_ref=MISR_AM1_GRP_ELLIPSOID_GM_P228_O003571_BF_F03_0024.hdf ',
>> '--file_cmp=MISR_AM1_GRP_ELLIPSOID_GM_P228_O003571_DF_F03_0024.hdf ',
>> '--block_start=62 ', '--block_end=62 ', '--istep=16 ',
>> "--chmetric='M2' ", "--use_textid='true '"]
>>
>
> [snip]
>
>>
>> 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__
>> errread, errwrite)
>> File "/usr/lib64/python2.5/subprocess.py", line 1051, in _execute_child
>> raise child_exception
>> OSError: [Errno 2] No such file or directory
>
> Try supplying a fully-qualified path to your script, e.g.:
> ['python /home/catherine/src_python/Match1.py ',
> '--file_ref=MISR_AM1_GRP_ELLIPSOID_GM_P228_O003571_BF_F03_0024.hdf ',
> '--file_cmp=MISR_AM1_GRP_ELLIPSOID_GM_P228_O003571_DF_F03_0024.hdf ',
> '--block_start=62 ', '--block_end=62 ', '--istep=16 ', "--chmetric='M2'
> ", "--use_textid='true '"]
>
>
>
More information about the Python-list
mailing list