IDL hates python? [message #76686] |
Thu, 23 June 2011 05:05  |
Gray
Messages: 253 Registered: February 2010
|
Senior Member |
|
|
Hi all,
As part of my very long and complicated IDL program (running in IDL
8.0.1), I use SPAWN to call a package (that I didn't write) which
involves some Python routines; example code, very stripped down:
for i=0,ndir-1 do begin
cd, dirs[i]
spawn, 'my_call_on_file_1'
spawn, 'my_call_on_file_2'
spawn, 'my_call_on_file_3'
do_a_bunch_of_other_stuff
cd, '..'
endfor
When I try to run my program from the IDLDE, I get an error from
stderr saying that the package couldn't find Python. When I run from
the IDL command line, it works fine the first pass through loop;
however, as soon as the loop iterates IDL loses track of Python
again. The upshot is that I can't automate my program to run over a
number of directories, I have to call it individually for each
directory, which is INCREDIBLY annoying and very inefficient. Here is
the error:
env: python: No such file or directory
augment-xylist.c:585:backtick: Failed to run command: /usr/local/
astrometry/bin/removelines.py CONT1.xyls /tmp/tmp.removelines.j0DItP
IDL knows where Python is, since it works fine on the first pass
through the loop (at least, when I call from the command line instead
of the DE, which I don't mind doing). However, on subsequent
iterations it fails. Is it just IDL trying to discourage Python use?
What's going on here?
Thanks to everyone for your help, as always.
--Gray
|
|
|
Re: IDL hates python? [message #76713 is a reply to message #76686] |
Wed, 29 June 2011 04:53  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Am 23.06.2011 14:05, schrieb Gray:
> Hi all,
>
> As part of my very long and complicated IDL program (running in IDL
> 8.0.1), I use SPAWN to call a package (that I didn't write) which
> involves some Python routines; example code, very stripped down:
>
> for i=0,ndir-1 do begin
> cd, dirs[i]
> spawn, 'my_call_on_file_1'
> spawn, 'my_call_on_file_2'
> spawn, 'my_call_on_file_3'
> do_a_bunch_of_other_stuff
> cd, '..'
> endfor
>
>
> When I try to run my program from the IDLDE, I get an error from
> stderr saying that the package couldn't find Python. When I run from
> the IDL command line, it works fine the first pass through loop;
> however, as soon as the loop iterates IDL loses track of Python
> again. The upshot is that I can't automate my program to run over a
> number of directories, I have to call it individually for each
> directory, which is INCREDIBLY annoying and very inefficient. Here is
> the error:
>
> env: python: No such file or directory
> augment-xylist.c:585:backtick: Failed to run command: /usr/local/
> astrometry/bin/removelines.py CONT1.xyls /tmp/tmp.removelines.j0DItP
>
> IDL knows where Python is, since it works fine on the first pass
> through the loop (at least, when I call from the command line instead
> of the DE, which I don't mind doing). However, on subsequent
> iterations it fails. Is it just IDL trying to discourage Python use?
> What's going on here?
Each spawn creates a new child process. Check if you run into a limit.
Look into the python script and enter the complete path to the hashbang.
Try if it is different if you avoid finding the interpreter by env.
Reimar
>
> Thanks to everyone for your help, as always.
>
> --Gray
|
|
|