Strange error: % Keyword parameters not allowed in call. [message #86291] |
Wed, 23 October 2013 08:21  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
Hi,
so, I've got this big program with lots of things happening. There is this method (function) used to get images called "GetRawImg" that calls a function "GetFile"
So the call is done this way:
fName = 'MyFileName.dat'
ErrorRes = 0B
Img = GetFile(fName, ErrorRes)
The function GetFile is defined this way:
FUNCTION GetFile, Filename, ErrorRes
I'm debugging this thing and when I get on the line
Img = GetFile(fName, ErrorRes)
and step further into GetFile, I get the error:
% Keyword parameters not allowed in call.
% Keyword parameters not allowed in call.
% Keyword parameters not allowed in call.
% Compiled module: GETFILE.
Yes, three times and after the call it shows that it has compiled GETFILE.
Does anybody have an idea where this is coming from? Is there somewhere a hidden procedure GETFILE that does not accept parameters? I closed all possible related projects before hand...
And when I call this procedure GETFILE the second time, no error is displayed.
Regards,
Helder
|
|
|
|
|
Re: Strange error: % Keyword parameters not allowed in call. [message #86298 is a reply to message #86293] |
Wed, 23 October 2013 15:10  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Wednesday, October 23, 2013 5:37:34 PM UTC+2, David Fanning wrote:
> Helder writes:
>
>
>
>> Yes, three times and after the call it shows that it has compiled GETFILE.
>
>> Does anybody have an idea where this is coming from? Is there somewhere a hidden procedure GETFILE that does not accept parameters?
>
>
>
> Or, if this is not in its own file (probably likely with a name like
>
> GetFile), compile GetRawImg, then type this command:
>
>
>
> IDL> Help, /Source
>
>
>
> and look for where it is finding GetFile.
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Thanks David for your quick answers. I was out of the office...
[I found the solution to the problem... after I wrote an answer. See below]
So I tested both solutions.
1) Print, File_Which('getfile.pro')
points to the correct file.
2) I tried compiling GetRawImg (method of an object) and I get all the methods compiled, but "getfile.pro" does not appear in the "Help, /source".
I tried executing the whole program with a break-point just before the getfile call. And just when I press F5 (step-into) I get the message:
% Keyword parameters not allowed in call.
% Keyword parameters not allowed in call.
% Keyword parameters not allowed in call.
% Compiled module: GETFILE.
% Stepped to: GETFILE 1 E:\CommonPros\InputPros\getfile.pro
+++++++++++++++++
Ok, so here was the problem.
In the function "getfile.pro" there was a typo that generated this error:
Return, Result = Dist(200)
I probably some when copied and pasted the "Result" after the return...
If you try this in a function you will just get the error:
% Keyword parameters not allowed in call.
I kept on looking at the definition of the function and how I was calling it... wrong place.
At least I dug the bug out of its nest.
Thanks David. Never used "help, /source". It's kind of spooky when you get so many lines out. You start to ask yourself if you should optimize your code. Once again.
Helder
|
|
|