Re: "Variable undefined" error in LOADCT? [message #61439] |
Thu, 17 July 2008 06:26  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On Jul 16, 7:20 pm, Ed Hyer <ejh...@gmail.com> wrote:
> Hi IDL Wizards,
>
> This one is interesting. Basically, I'm running a batch graphics
> routine making a bunch of plots, and periodically LOADCT gets called,
> in this form:
>
> LOADCT,39,/silent
>
> Now, lately this routine will run for a while (several plots) and then
> break, with the error:
>
> % Variable is undefined: FILENAME.
> % Error occurred at: LOADCT 180
>
> Here is the relevant code from loadct.pro:
>
> if (n_elements(file) GT 0) then filename = file $
> else filename = filepath('colors1.tbl', subdir=['resource', 'colors'])
> openr,lun, filename, /block
>
> Has anyone ever seen this error?
So what do you get from filepath()?
IDL> print, filepath('colors1.tbl', subdir=['resource', 'colors'])
% Compiled module: FILEPATH.
% Compiled module: PATH_SEP.
C:\Program Files\ITT\IDL70\resource\colors\colors1.tbl
Installation problem?
|
|
|
Re: "Variable undefined" error in LOADCT? [message #61443 is a reply to message #61439] |
Wed, 16 July 2008 19:58   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ed Hyer writes:
> This one is interesting. Basically, I'm running a batch graphics
> routine making a bunch of plots, and periodically LOADCT gets called,
> in this form:
>
> LOADCT,39,/silent
>
> Now, lately this routine will run for a while (several plots) and then
> break, with the error:
>
> % Variable is undefined: FILENAME.
> % Error occurred at: LOADCT 180
>
> Here is the relevant code from loadct.pro:
>
> if (n_elements(file) GT 0) then filename = file $
> else filename = filepath('colors1.tbl', subdir=['resource', 'colors'])
> openr,lun, filename, /block
>
> Has anyone ever seen this error?
Wow. Are you sure you have the right LOADCT call?
It is not being called in some other program, is it?
Sometimes a variable like "file" or "filename" will
change unexpectedly in a program. Especially in a
long batch program.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: "Variable undefined" error in LOADCT? [message #61499 is a reply to message #61439] |
Thu, 17 July 2008 17:47  |
MarioIncandenza
Messages: 231 Registered: February 2005
|
Senior Member |
|
|
OK. SHORT ANSWER: Ran out of LUNs. Somewhere one of my routines isn't
cleaning up after itself.
LONG ANSWER: The LOADCT routine uses error redirection to spew a
generic error message on IO errors. Here is the code for this
redirection:
on_ioerror, bad
<...>
bad:
message, /CONTINUE, 'Error reading file: ' + filename + ', ' + !
error_state.msg
Now, LOADCT wants to read a file with the color table, and that error
is intended to tell you if the color table you want is missing. But
before the FILENAME is even set by LOAD_CT, it runs GET_LUN to assign
an LUN to read the file. When that command fails, it goes to 'bad' and
then it croaks because FILENAME isn't defined.
--Edward H.
|
|
|