Hi All,
I have created a procedure that I can execute from a window command
line
for example,
idlde sayhello -args param1 param2
when i ran this procedure using the .sav file it didn't work, for
example
idl -vm = sayhello.sav -args param1 param2
It complains that the sayhello.sav function/procedure is undefined
but the sayhello.sav file does exist. Please let me know if the way I
execute my
procedure using the .sav file is correct.
Thanks!
|
|
0
|
|
|
|
Reply
|
truongvle (4)
|
11/15/2010 1:22:03 AM |
|
Truong Le writes:
> It complains that the sayhello.sav function/procedure is undefined
> but the sayhello.sav file does exist. Please let me know if the way I
> execute my
> procedure using the .sav file is correct.
Have you tried specifying the complete path to the file?
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.")
|
|
0
|
|
|
|
Reply
|
David
|
11/15/2010 1:28:50 AM
|
|
On Nov 14, 8:28=A0pm, David Fanning <n...@dfanning.com> wrote:
> Truong Le writes:
> > It complains that the sayhello.sav =A0function/procedure is undefined
> > but the sayhello.sav file does exist. Please let me know if the way I
> > execute my
> > procedure using the .sav file is correct.
>
> Have you tried specifying the complete path to the file?
>
> 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.")
when I type
idl sayhello.sav -args param1 param2
there is a directory widget the pop-up which allows me to select the
sayhello.sav,
so I am sure the path is correct.
|
|
0
|
|
|
|
Reply
|
Truong
|
11/15/2010 1:42:06 AM
|
|
On Nov 14, 8:42=A0pm, Truong Le <truong...@gmail.com> wrote:
> On Nov 14, 8:28=A0pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
> > Truong Le writes:
> > > It complains that the sayhello.sav =A0function/procedure is undefined
> > > but the sayhello.sav file does exist. Please let me know if the way I
> > > execute my
> > > procedure using the .sav file is correct.
>
> > Have you tried specifying the complete path to the file?
>
> > 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.")
>
> when I type
>
> idl sayhello.sav -args param1 param2
>
> there is a directory widget the pop-up which allows me to select the
> sayhello.sav,
> so I am sure the path is correct.
I read other posting and realize that I can't run the .sav file with -
args.
Here is an example what I try to accomplish.
I have a procedure that takes command line arguments as follow:
pro test
; parse the parameters
numArgs =3D 2
par =3D COMMAND_LINE_ARGS(COUNT=3DnumArgs)
print, par[0]
print, par[1]
end
when I ran this procedure from the dos command line using idlde by
doing
idlde -args hello hi
and execute the test procedure it print both "hello" and "hi"
I ran the idlde build project and this creates a test.sav file
I need to know how I can execute idl -vm =3D test.sav from the unix and
passing
in the two arguments that I need. Is this task not possible?
Thanks
|
|
0
|
|
|
|
Reply
|
Truong
|
11/15/2010 4:53:44 PM
|
|
On 11/15/10 11:53 AM, Truong Le wrote:
> On Nov 14, 8:42 pm, Truong Le<truong...@gmail.com> wrote:
>> On Nov 14, 8:28 pm, David Fanning<n...@dfanning.com> wrote:
>>
>>
>>
>>> Truong Le writes:
>>>> It complains that the sayhello.sav function/procedure is undefined
>>>> but the sayhello.sav file does exist. Please let me know if the way I
>>>> execute my
>>>> procedure using the .sav file is correct.
>>
>>> Have you tried specifying the complete path to the file?
>>
>>> 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.")
>>
>> when I type
>>
>> idl sayhello.sav -args param1 param2
>>
>> there is a directory widget the pop-up which allows me to select the
>> sayhello.sav,
>> so I am sure the path is correct.
>
> I read other posting and realize that I can't run the .sav file with -
> args.
> Here is an example what I try to accomplish.
>
> I have a procedure that takes command line arguments as follow:
>
> pro test
>
> ; parse the parameters
> numArgs = 2
> par = COMMAND_LINE_ARGS(COUNT=numArgs)
>
> print, par[0]
> print, par[1]
> end
>
> when I ran this procedure from the dos command line using idlde by
> doing
> idlde -args hello hi
>
> and execute the test procedure it print both "hello" and "hi"
>
> I ran the idlde build project and this creates a test.sav file
>
> I need to know how I can execute idl -vm = test.sav from the unix and
> passing
> in the two arguments that I need. Is this task not possible?
>
> Thanks
Hi,
I suspect that the spaces you have inserted around "=" might be part of
the issue.
Here's how I run it from command line.
Minke:~ ben$ idl -vm=cmd_args.sav -args hello world
IDL Version 7.1, Mac OS X (darwin x86_64 m64). (c) 2009, ITT Visual
Information Solutions
arg[0] = hello
arg[1] = world
Here's my test routine
PRO cmd_args
par = COMMAND_LINE_ARGS(COUNT=numArgs)
IF (numArgs NE 0) THEN BEGIN
for i = 0, numArgs-1 do $
print, "arg[" + StrTrim(i,2) + "] = " + par[i]
ENDIF ELSE BEGIN
print, "No arguments passed"
ENDELSE
END
I made the SAV file this way...
IDL> .full_reset
IDL> .comp cmd_args
% Compiled module: CMD_ARGS.
IDL> SAVE, /ROUTINES, filename = "cmd_args.sav"
Cheers,
Ben
|
|
0
|
|
|
|
Reply
|
Ben
|
11/15/2010 5:27:20 PM
|
|
On Nov 15, 3:27=A0pm, Ben Tupper <ben.bigh...@gmail.com> wrote:
> Hi,
>
> I suspect that the spaces you have inserted around "=3D" might be part of
> the issue.
>
> Here's how I run it from command line.
>
> Minke:~ ben$ idl -vm=3Dcmd_args.sav -args hello world
That is just what I was writing. I have used command line arguments
with save files in just that way, with no problems. The pick file
dialog is what IDL shows if one calls it with the -vm argument without
specifying the savefile to use.
|
|
0
|
|
|
|
Reply
|
Paulo
|
11/15/2010 5:36:38 PM
|
|
On Nov 15, 12:27=A0pm, Ben Tupper <ben.bigh...@gmail.com> wrote:
> On 11/15/10 11:53 AM, Truong Le wrote:
>
>
>
> > On Nov 14, 8:42 pm, Truong Le<truong...@gmail.com> =A0wrote:
> >> On Nov 14, 8:28 pm, David Fanning<n...@dfanning.com> =A0wrote:
>
> >>> Truong Le writes:
> >>>> It complains that the sayhello.sav =A0function/procedure is undefine=
d
> >>>> but the sayhello.sav file does exist. Please let me know if the way =
I
> >>>> execute my
> >>>> procedure using the .sav file is correct.
>
> >>> Have you tried specifying the complete path to the file?
>
> >>> 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.")
>
> >> when I type
>
> >> idl sayhello.sav -args param1 param2
>
> >> there is a directory widget the pop-up which allows me to select the
> >> sayhello.sav,
> >> so I am sure the path is correct.
>
> > I read other posting and realize that I can't run the .sav file with -
> > args.
> > Here is an example what I try to accomplish.
>
> > I have a procedure that takes command line arguments as follow:
>
> > pro test
>
> > =A0 =A0 ; parse the parameters
> > =A0 =A0 numArgs =3D 2
> > =A0 =A0 par =3D COMMAND_LINE_ARGS(COUNT=3DnumArgs)
>
> > =A0 =A0 print, par[0]
> > =A0 =A0 print, par[1]
> > end
>
> > when I ran this procedure from the dos command line using idlde by
> > doing
> > idlde -args hello hi
>
> > and execute the test procedure it print both "hello" and "hi"
>
> > I ran the idlde build project and this creates a test.sav file
>
> > I need to know how I can execute idl -vm =3D test.sav from the unix and
> > passing
> > in the two arguments that I need. Is this task not possible?
>
> > Thanks
>
> Hi,
>
> I suspect that the spaces you have inserted around "=3D" might be part of
> the issue.
>
> Here's how I run it from command line.
>
> Minke:~ ben$ idl -vm=3Dcmd_args.sav -args hello world
> IDL Version 7.1, Mac OS X (darwin x86_64 m64). (c) 2009, ITT Visual
> Information Solutions
>
> arg[0] =3D hello
> arg[1] =3D world
>
> Here's my test routine
>
> PRO cmd_args
>
> =A0 =A0 par =3D COMMAND_LINE_ARGS(COUNT=3DnumArgs)
> =A0 =A0 IF (numArgs NE 0) THEN BEGIN
> =A0 =A0 =A0 =A0for i =3D 0, numArgs-1 do $
> =A0 =A0 =A0 =A0 =A0 print, "arg[" + StrTrim(i,2) + "] =3D " + par[i]
> =A0 =A0 ENDIF ELSE BEGIN
> =A0 =A0 =A0 =A0print, "No arguments passed"
> =A0 =A0 ENDELSE
>
> END
>
> I made the SAV file this way...
>
> IDL> .full_reset
> IDL> .comp cmd_args
> % Compiled module: CMD_ARGS.
> IDL> SAVE, /ROUTINES, filename =3D "cmd_args.sav"
>
> Cheers,
> Ben
It works! thanks Ben
|
|
0
|
|
|
|
Reply
|
Truong
|
11/15/2010 8:31:30 PM
|
|
On Nov 15, 3:31=A0pm, Truong Le <truong...@gmail.com> wrote:
> On Nov 15, 12:27=A0pm, Ben Tupper <ben.bigh...@gmail.com> wrote:
>
>
>
> > On 11/15/10 11:53 AM, Truong Le wrote:
>
> > > On Nov 14, 8:42 pm, Truong Le<truong...@gmail.com> =A0wrote:
> > >> On Nov 14, 8:28 pm, David Fanning<n...@dfanning.com> =A0wrote:
>
> > >>> Truong Le writes:
> > >>>> It complains that the sayhello.sav =A0function/procedure is undefi=
ned
> > >>>> but the sayhello.sav file does exist. Please let me know if the wa=
y I
> > >>>> execute my
> > >>>> procedure using the .sav file is correct.
>
> > >>> Have you tried specifying the complete path to the file?
>
> > >>> 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.")
>
> > >> when I type
>
> > >> idl sayhello.sav -args param1 param2
>
> > >> there is a directory widget the pop-up which allows me to select the
> > >> sayhello.sav,
> > >> so I am sure the path is correct.
>
> > > I read other posting and realize that I can't run the .sav file with =
-
> > > args.
> > > Here is an example what I try to accomplish.
>
> > > I have a procedure that takes command line arguments as follow:
>
> > > pro test
>
> > > =A0 =A0 ; parse the parameters
> > > =A0 =A0 numArgs =3D 2
> > > =A0 =A0 par =3D COMMAND_LINE_ARGS(COUNT=3DnumArgs)
>
> > > =A0 =A0 print, par[0]
> > > =A0 =A0 print, par[1]
> > > end
>
> > > when I ran this procedure from the dos command line using idlde by
> > > doing
> > > idlde -args hello hi
>
> > > and execute the test procedure it print both "hello" and "hi"
>
> > > I ran the idlde build project and this creates a test.sav file
>
> > > I need to know how I can execute idl -vm =3D test.sav from the unix a=
nd
> > > passing
> > > in the two arguments that I need. Is this task not possible?
>
> > > Thanks
>
> > Hi,
>
> > I suspect that the spaces you have inserted around "=3D" might be part =
of
> > the issue.
>
> > Here's how I run it from command line.
>
> > Minke:~ ben$ idl -vm=3Dcmd_args.sav -args hello world
> > IDL Version 7.1, Mac OS X (darwin x86_64 m64). (c) 2009, ITT Visual
> > Information Solutions
>
> > arg[0] =3D hello
> > arg[1] =3D world
>
> > Here's my test routine
>
> > PRO cmd_args
>
> > =A0 =A0 par =3D COMMAND_LINE_ARGS(COUNT=3DnumArgs)
> > =A0 =A0 IF (numArgs NE 0) THEN BEGIN
> > =A0 =A0 =A0 =A0for i =3D 0, numArgs-1 do $
> > =A0 =A0 =A0 =A0 =A0 print, "arg[" + StrTrim(i,2) + "] =3D " + par[i]
> > =A0 =A0 ENDIF ELSE BEGIN
> > =A0 =A0 =A0 =A0print, "No arguments passed"
> > =A0 =A0 ENDELSE
>
> > END
>
> > I made the SAV file this way...
>
> > IDL> .full_reset
> > IDL> .comp cmd_args
> > % Compiled module: CMD_ARGS.
> > IDL> SAVE, /ROUTINES, filename =3D "cmd_args.sav"
>
> > Cheers,
> > Ben
>
> It works! thanks Ben
what do I need to modify to run the .sav file from the window
environment.
I know that window doesn't run idl but idlde so any help is
appreciated.
Thanks
|
|
0
|
|
|
|
Reply
|
Truong
|
11/15/2010 10:42:23 PM
|
|
On 11/15/10 5:42 PM, Truong Le wrote:
> On Nov 15, 3:31 pm, Truong Le<truong...@gmail.com> wrote:
>
> what do I need to modify to run the .sav file from the window
> environment.
> I know that window doesn't run idl but idlde so any help is
> appreciated.
>
> Thanks
Hi,
Look at the online docs for "Command Line Options for IDL Startup" (in
IDL 7 help it is buried in "IDL Users' Guides > Using IDL > Introducing
IDL") - scroll to the bottom for Windows specific info regarding this.
Cheers,
Ben
|
|
0
|
|
|
|
Reply
|
Ben
|
11/15/2010 11:24:55 PM
|
|
On Nov 15, 6:24=A0pm, Ben Tupper <ben.bigh...@gmail.com> wrote:
> On 11/15/10 5:42 PM, Truong Le wrote:
>
> > On Nov 15, 3:31 pm, Truong Le<truong...@gmail.com> =A0wrote:
>
> > what do I need to modify to run the .sav file from the window
> > environment.
> > I know that window doesn't run idl but idlde so any help is
> > appreciated.
>
> > Thanks
>
> Hi,
>
> Look at the online docs for "Command Line Options for IDL Startup" (in
> IDL 7 help it is buried in "IDL Users' Guides > Using IDL > Introducing
> IDL") - scroll to the bottom for Windows specific info regarding this.
>
> Cheers,
> Ben
Okay, I ran the above example from the window command line but it
doesn't print the expected
result. It ran through the process that I seen when I ran it under
unix. Under the unix I seen the
words Hello and World printed out but not when I ran under the window
environment. It didn't give
any error message so I am at a lost.
idlrt -vm=3Dcmd_args.sav -args Hello World
|
|
0
|
|
|
|
Reply
|
Truong
|
11/16/2010 12:16:42 AM
|
|
On Nov 15, 7:16=A0pm, Truong Le <truong...@gmail.com> wrote:
> On Nov 15, 6:24=A0pm, Ben Tupper <ben.bigh...@gmail.com> wrote:
>
>
>
> > On 11/15/10 5:42 PM, Truong Le wrote:
>
> > > On Nov 15, 3:31 pm, Truong Le<truong...@gmail.com> =A0wrote:
>
> > > what do I need to modify to run the .sav file from the window
> > > environment.
> > > I know that window doesn't run idl but idlde so any help is
> > > appreciated.
>
> > > Thanks
>
> > Hi,
>
> > Look at the online docs for "Command Line Options for IDL Startup" (in
> > IDL 7 help it is buried in "IDL Users' Guides > Using IDL > Introducing
> > IDL") - scroll to the bottom for Windows specific info regarding this.
>
> > Cheers,
> > Ben
>
> Okay, I ran the above example from the window command line but it
> doesn't print the expected
> result. It ran through the process that I seen when I ran it under
> unix. Under the unix I seen the
> words Hello and World printed out but not when I ran under the window
> environment. It didn't give
> any error message so I am at a lost.
>
> idlrt -vm=3Dcmd_args.sav -args Hello World
okay, I find out that print, var won't work in the virtual machine
under windows. I have to use printf.
|
|
0
|
|
|
|
Reply
|
Truong
|
11/16/2010 1:45:58 AM
|
|
On Nov 15, 8:45=A0pm, Truong Le <truong...@gmail.com> wrote:
> On Nov 15, 7:16=A0pm, Truong Le <truong...@gmail.com> wrote:
>
>
>
> > On Nov 15, 6:24=A0pm, Ben Tupper <ben.bigh...@gmail.com> wrote:
>
> > > On 11/15/10 5:42 PM, Truong Le wrote:
>
> > > > On Nov 15, 3:31 pm, Truong Le<truong...@gmail.com> =A0wrote:
>
> > > > what do I need to modify to run the .sav file from the window
> > > > environment.
> > > > I know that window doesn't run idl but idlde so any help is
> > > > appreciated.
>
> > > > Thanks
>
> > > Hi,
>
> > > Look at the online docs for "Command Line Options for IDL Startup" (i=
n
> > > IDL 7 help it is buried in "IDL Users' Guides > Using IDL > Introduci=
ng
> > > IDL") - scroll to the bottom for Windows specific info regarding this=
..
>
> > > Cheers,
> > > Ben
>
> > Okay, I ran the above example from the window command line but it
> > doesn't print the expected
> > result. It ran through the process that I seen when I ran it under
> > unix. Under the unix I seen the
> > words Hello and World printed out but not when I ran under the window
> > environment. It didn't give
> > any error message so I am at a lost.
>
> > idlrt -vm=3Dcmd_args.sav -args Hello World
>
> okay, I find out that print, var won't work in the virtual machine
> under windows. I have to use printf.
Hi Ben,
I have successfully executed the example above in the window
environment and
so I set out to build a more complicated procedures that I need to
create for
my work. After I build my .sav file from using idlde and ran the .sav
file
using idlrt -vm=3Dfilename.sav -args param1 param2 ...
I get the attempt to call undefined procedure/function:'filename'
message.
The .sav file is in the directory. Please let me know what I did
wrong.
Thanks
|
|
0
|
|
|
|
Reply
|
Truong
|
11/16/2010 3:03:33 AM
|
|
On Nov 16, 1:03=A0am, Truong Le <truong...@gmail.com> wrote:
> I have successfully executed the example above in the window
> environment and
> so I set out to build a more complicated procedures that I need to
> create for
> my work. After I build my .sav file from using idlde and ran the .sav
> file
> using idlrt -vm=3Dfilename.sav -args param1 param2 ...
>
> I get the attempt to call undefined procedure/function:'filename'
> message.
> The .sav file is in the directory. Please let me know what I did
> wrong.
Does 'filename.sav' contain a procedure named 'filename'?
|
|
0
|
|
|
|
Reply
|
Paulo
|
11/16/2010 3:09:14 AM
|
|
On Nov 15, 10:09=A0pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On Nov 16, 1:03=A0am, Truong Le <truong...@gmail.com> wrote:
>
> > I have successfully executed the example above in the window
> > environment and
> > so I set out to build a more complicated procedures that I need to
> > create for
> > my work. After I build my .sav file from using idlde and ran the .sav
> > file
> > using idlrt -vm=3Dfilename.sav -args param1 param2 ...
>
> > I get the attempt to call undefined procedure/function:'filename'
> > message.
> > The .sav file is in the directory. Please let me know what I did
> > wrong.
>
> Does 'filename.sav' contain a procedure named 'filename'?
no
|
|
0
|
|
|
|
Reply
|
Truong
|
11/16/2010 3:28:24 AM
|
|
On Nov 15, 10:09=A0pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On Nov 16, 1:03=A0am, Truong Le <truong...@gmail.com> wrote:
>
> > I have successfully executed the example above in the window
> > environment and
> > so I set out to build a more complicated procedures that I need to
> > create for
> > my work. After I build my .sav file from using idlde and ran the .sav
> > file
> > using idlrt -vm=3Dfilename.sav -args param1 param2 ...
>
> > I get the attempt to call undefined procedure/function:'filename'
> > message.
> > The .sav file is in the directory. Please let me know what I did
> > wrong.
>
> Does 'filename.sav' contain a procedure named 'filename'?
I thought you can name the .sav file whatever you want to.
|
|
0
|
|
|
|
Reply
|
Truong
|
11/16/2010 3:31:00 AM
|
|
Truong Le writes:
> I thought you can name the .sav file whatever you want to.
Yes, as long as it is the name of the program you are trying
to run. :-)
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.")
|
|
0
|
|
|
|
Reply
|
David
|
11/16/2010 3:43:22 AM
|
|
On Nov 15, 10:43=A0pm, David Fanning <n...@dfanning.com> wrote:
> Truong Le writes:
> > I thought you can name the .sav file whatever you want to.
>
> Yes, as long as it is the name of the program you are trying
> to run. :-)
>
> 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.")
okay, thanks guys! it works!
|
|
0
|
|
|
|
Reply
|
Truong
|
11/16/2010 3:45:11 AM
|
|
On 11/15/10 10:03 PM, Truong Le wrote:
>
> Hi Ben,
>
> I have successfully executed the example above in the window
> environment and
> so I set out to build a more complicated procedures that I need to
> create for
> my work. After I build my .sav file from using idlde and ran the .sav
> file
> using idlrt -vm=filename.sav -args param1 param2 ...
>
> I get the attempt to call undefined procedure/function:'filename'
> message.
> The .sav file is in the directory. Please let me know what I did
> wrong.
Hi,
I suspect that this is *not* an issue with the Virtual Machine. To get
the most useful help from the list, you should post the complete error
message - exactly as IDL prints it.
Without more info we can only guess, and my guess is that somewhere you
have a variable called "filename" that you are indexing with parentheses
instead of square brackets.
filename(i) <-- IDL might think filename is a function
filename[i] <-- an element of a variable 'filename'
But, then again, you might actually have a routine called 'filename'
that didn't get compiled and stuffed into the save file, but,
nonetheless, gets called by the code that did make it into the save file.
Ben
|
|
0
|
|
|
|
Reply
|
Ben
|
11/16/2010 3:59:08 AM
|
|
|
17 Replies
144 Views
(page loaded in 0.445 seconds)
Similiar Articles:7/24/2012 3:58:50 PM
|