Re: inconsistent results running an absurdly simple function using 'spawn' [message #78703] |
Wed, 14 December 2011 10:34 |
Carsten Lechte
Messages: 124 Registered: August 2006
|
Senior Member |
|
|
On 12/14/2011 07:12 PM, desertdryad wrote:
> I need to run this function without altering the code back and forth
> each session. Any idea what's going on, here??
Add a "HELP, result" to check the number of elements. Does this change between calls to
SPAWN?
Make sure you actually have recompiled the function when you change the RETURN statement.
chl
|
|
|
Re: inconsistent results running an absurdly simple function using 'spawn' [message #78704 is a reply to message #78703] |
Wed, 14 December 2011 10:33  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
desertdryad writes:
>
> 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??
This sounds like a PATH problem to me. Are you sure
you don't have multiple versions of this program
in different locations? I would try to make sure
you are always calling the program you *think* you
are calling.
IDL> Help, /Source
might give you some clues.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|