inconsistent results running an absurdly simple function using 'spawn' [message #78705] |
Wed, 14 December 2011 10:12 |
desertdryad
Messages: 39 Registered: August 2011
|
Member |
|
|
I have a problem that is making me batty, on IDL 7.0.
I'm trying to use a simple function I wrote, that spawns a clal to a
Perl script. IT works as I expect, 'some of' the time in a
predictable fashion. Here is the script:
--------------------------
compile_opt idl2
spawn, 'C:\\Cyndys\WEATHER\mesomech3.pl '+station, result
print, result
data=result[4]
return, data
end
---------------------------
So, I wish the function to return the 4th line of output from the Perl
script (which reads stuff from a web page for me).
The first time in a session that I try to run this, it will NOT work;
I get this error at run time:
% Attempt to subscript RESULT with <LONG ( 4)> is out of
range
NOW, here's the bizarro part - if I take out 'return, data[4]' and
replace it with 'return, data' the function works. But THEN, if I put
that line of code back to 'return, data[4]' .. that then also works!
What the Hey.
I need to run this function without altering the code back and forth
each session. Any idea what's going on, here??
thanks!
|
|
|