[GRASS5] nviz problem

Bob Covill bcovill at tekmap.ns.ca
Mon Dec 20 13:28:27 EST 2004


Hi,

The script is mean't as a temporary fix so that you can run nviz with
options in the background (&). Try "./i -q &" and nviz should start up
in quick mode running in the background.

Nviz uses both G_parser and wish style arguments. In other words nviz is
   a customized version of wish that accepts GRASS style commands. The
trick is to make sure that the GRASS commands are not stripped out by
the TK wish portion. The "-f" flag tells it to execute the script
(nviz2.2_script in our case) in the same way that wish would execute a
script. Remember that the current nviz executable is simply the old
NVWISH renamed.

The problem seems to be related to the fact that nviz2.2_script is
currently executed internally with Tcl_Eval. If nviz is executed in the
background the whole thing hangs up. The trick is to figure out how to
call this correctly?

--
Bob

Huidae Cho wrote:
 > Hi,
 >
 > Your fix doesn't work:
 > ----------------------
 > GRASS 5.7.cvs:~/tmp > cat i
 > #!/bin/sh
 > exec nviz -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script "$@"
 > GRASS 5.7.cvs:~/tmp > ./i
 > Illegal filename. character </> not allowed.Error: Raster 
/home/geni/usr/grass/grass51/dist.i686-pc-cygwin/etc/nviz2.2/scripts/nviz2.2_script 
does not exist in current Mapset
 > Load Failed
 > GRASS 5.7.cvs:~/tmp >
 > ----------------------
 >
 > nviz2.2_script is not a map but a script. The error message comes 
from the
 > grass parser library not from tcl/tk.  I think nviz is a grass module 
itself,
 > so it doesn't accept parameters except grass ones.
 >
 > If -f option is given:
 > nviz -f nviz_script grass parameters
 >
 > Otherwise:
 > nviz -- grass parameters
 >
 > This is what I understand, but where does nviz do something for "-f"
 > option? I cannot find it.
 >
 > When I run "nviz -f elev=dem500" which should be wrong, nviz displays
 > dem500 and tries to find "elev=dem500" script without success:
 > ----------------------
 > Loading Data
 > translating colors from fp
 > recalculating normals...
 > Error in startup script: couldn't read file "elev=dem500": no such file
 > or directory
 > ----------------------
 >
 > I think the tcl/tk parser conflicts with the grass parser and maybe
 > tcl/tk sould have a priority here.
 >
 >
 > Thank you.
 > Huidae Cho
 >
 >
 > On Mon, Dec 20, 2004 at 09:18:11AM -0400, Bob Covill wrote:
 >
 >>Hi,
 >>
 >>I was finally able to duplicate the background error on my RedHat 7.3
 >>system. For some reason it works fine on my RedHat 9 system.
 >>
 >>I have searched the Tcl/Tk archives for documentation of similar
 >>problems, but found nothing.
 >>
 >>In the meantime I have got the following script to work.
 >>
 >>#!/bin/sh
 >>exec nviz -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script "$@"
 >>
 >>This seems to work if started in the foreground or background, but I
 >>have not tested it properly. In order to use the above script you have
 >>to first edit nviz_init.c in visualization/nviz/src and comment out the
 >>following line ...
 >>
 >>    if (!script_mode)
 >>            Tcl_Eval(interp, nviz_script); /* source nviz_script to
 >>start main window */
 >>
 >>After commenting, rebuild nviz and run the above script. Hopefully this
 >>will work for you.
 >>
 >>Now that I have an idea of where the problem is originating, hopefully I
 >>can figure out a more permanent solution. Suggestions welcome.
 >>
 >>--
 >>Bob
 >>
 >>
 >>Huidae Cho wrote:
 >>
 >>>Hi, output is the following:
 >>>
 >>>GRASS 5.7.cvs:~/tmp > cat a
 >>>#!/bin/sh
 >>>exec nviz "$0" "$@"
 >>>GRASS 5.7.cvs:~/tmp > ./a elev=dem&
 >>>[1] 1112
 >>>GRASS 5.7.cvs:~/tmp > Loading Data
 >>>Loading Data
 >>>translating colors
 >>>recalculating normals...
 >>>% w 100
 >>>
 >>>[1]+  Stopped                 ./a elev=dem
 >>>GRASS 5.7.cvs:~/tmp >
 >>>
 >>>It stops just after displaying map and empty control windows and
 >>>if I "fg", it starts working again.
 >>>
 >>>I think behavior is not consistent from system to system.
 >>>
 >>>
 >>>Huidae Cho
 >>>
 >>>
 >>>On Sat, Dec 18, 2004 at 04:29:33PM +0000, Bob Covill wrote:
 >>>
 >>>
 >>>>Hi,
 >>>>
 >>>>
 >>>>
 >>>>This is an interesting one. If I execute something like "nviz -q 
&", nviz
 >>>>
 >>>>starts up normally with the wish (%) prompt. If I hit enter at the 
prompt
 >>>>I
 >>>>
 >>>>am returned to the normal command line prompt and can run other 
commands
 >>>>
 >>>>(while nviz is running). When I quit nviz I get the respone on the 
command
 >>>>
 >>>>line ...
 >>>>
 >>>>[1]+  Done                    nviz -q
 >>>>
 >>>>which is what I would expect from a command that has been running 
in the
 >>>>
 >>>>background.
 >>>>
 >>>>
 >>>>
 >>>>Out of curiousity try creating a simple startup script with the 
following:
 >>>>
 >>>>
 >>>>
 >>>>#!/bin/sh
 >>>>
 >>>>exec nviz "$0" "$@"
 >>>>
 >>>>
 >>>>
 >>>>Make it executable and try running it in the background. For 
example if
 >>>>you
 >>>>
 >>>>name the script nv_start.sh, try "nv_start.sh elev=dem &" and see 
if that
 >>>>
 >>>>works.
 >>>>
 >>>>
 >>>>
 >>>>--
 >>>>
 >>>>Bob
 >>>>
 >>>>
 >>>>
 >>>>
 >>>>
 >>>>On 12/18/2004, "Huidae Cho" <grass4u at gmail.com> wrote:
 >>>>
 >>>>
 >>>>
 >>>>
 >>>>
 >>>>>Interesting!
 >>>>
 >>>>>Is wish running in background? As I know, a shell-like program 
cannot be
 >>>>
 >>>>>running in that way because if it's bg'ed or run with "&", /bin/sh or
 >>>>
 >>>>>the login shell takes control of stdin so that users can stay in the
 >>>>>login
 >>>>
 >>>>>shell.
 >>>>
 >>>>>If it's executed by a script, then it's ok because it's a usual shell
 >>>>
 >>>>>script.
 >>>>
 >>>>>Do you mean running "nviz" and executing other programs in the "%" 
nviz
 >>>>
 >>>>>prompt instead of running "nviz &"?
 >>>>
 >>>>>If wish is running in background (wish &), how can you execute wish
 >>>>
 >>>>functions?
 >>>>
 >>>>
 >>>>
 >>>>>Thank you.
 >>>>
 >>>>>Huidae Cho
 >>>>
 >>>>>On Sat, Dec 18, 2004 at 01:22:50PM +0000, Bob Covill wrote:
 >>>>
 >>>>>>Hi,
 >>>>>
 >>>>>>It appears that not even wish will run in the background on your 
system
 >>>>>
 >>>>...
 >>>>
 >>>>
 >>>>
 >>>>>>very strange.
 >>>>>
 >>>>>>The current nviz IS the old NVWISH executable which was called was
 >>>>>>called
 >>>>>
 >>>>by
 >>>>
 >>>>
 >>>>
 >>>>>>the old nviz shell script. The reason I got rid of the shell 
script was
 >>>>>
 >>>>>>because when nviz encountered an error the same un-informitive 
message
 >>>>>
 >>>>was
 >>>>
 >>>>
 >>>>
 >>>>>>generated because it was passed through the script. Also, there are a
 >>>>>
 >>>>number
 >>>>
 >>>>
 >>>>
 >>>>>>of error catches in the actual nviz tcl scripts which were completely
 >>>>>
 >>>>ignored
 >>>>
 >>>>
 >>>>
 >>>>>>with the old shell startup.
 >>>>>
 >>>>>>Before reverting to the old startup it would be nice to know why wish
 >>>>>
 >>>>(and
 >>>>
 >>>>
 >>>>
 >>>>>>nviz) will not run in the background on some systems. On both of my
 >>>>>
 >>>>RedHat
 >>>>
 >>>>
 >>>>
 >>>>>>systems it runs fine both in the background and the foreground.
 >>>>>
 >>>>>>--
 >>>>>
 >>>>>>Bob
 >>>>>
 >>>>>>On 12/18/2004, "Huidae Cho" <grass4u at gmail.com> wrote:
 >>>>>
 >>>>>>>Hi,
 >>>>>>
 >>>>>>>Now nviz is not a *wish script but a shell itself. That's why it 
prints
 >>>>>>
 >>>>>>>a prompt and we cannot execute it background and inside "d.m &". 
To fix
 >>>>>>
 >>>>>>>this problem, I think we should go back to NVWISH because 
running nviz
 >>>>>>
 >>>>>>>foreground is pain.
 >>>>>>
 >>>>>>>You can test this:
 >>>>>>
 >>>>>>>	wish &
 >>>>>>
 >>>>>>>prints % prompt and just stop!
 >>>>>>
 >>>>>>>Huidae Cho
 >>>>>>
 >>>>>>>On Fri, Dec 17, 2004 at 09:02:39PM -0400, Bob Covill wrote:
 >>>>>>
 >>>>>>>>Hello,
 >>>>>>>
 >>>>>>>>I tried running the latest version of nviz in the background with
 >>>>>>>
 >>>>>>>>various options and it seems to work fine. The "%" prompt that 
you see
 >>>>>>>
 >>>>>>>>is perfectly normal. The nviz program is simply a customized 
version
 >>>>>>>
 >>>>of
 >>>>
 >>>>
 >>>>
 >>>>>>>>the Tcl/Tk "wish" executable. Try executing "wish" on the 
command line
 >>>>>>>
 >>>>>>>>and you should see the same prompt.
 >>>>>>>
 >>>>>>>>As for it crashing when it is run in the background, I have no 
idea.
 >>>>>>>
 >>>>You
 >>>>
 >>>>
 >>>>
 >>>>>>>>might try changing GRASS_MESSAGE_FORMAT environment variable to 
see if
 >>>>>>>
 >>>>>>>>that has any effect.
 >>>>>>>
 >>>>>>>>It might help to know what platform and Tcl/Tk version it is 
failing
 >>>>>>>
 >>>>on.
 >>>>
 >>>>
 >>>>
 >>>>>>>>For me it works on RedHat 7.3 with Tk8.3, and RedHat 9 with Tk8.4.
 >>>>>>>
 >>>>>>>>--
 >>>>>>>
 >>>>>>>>Bob
 >>>>>>>
 >>>>>>>>Helena wrote:
 >>>>>>>
 >>>>>>>>>Huidae Cho wrote:
 >>>>>>>>
 >>>>>>>>>>Hi,
 >>>>>>>>>
 >>>>>>>>>>I noticed today that nviz doesn't work if I run it background as
 >>>>>>>>>
 >>>>>>before.
 >>>>>
 >>>>>>>>>>Similarly, it just stops after displaying a map when it's 
executed
 >>>>>>>>>
 >>>>from
 >>>>
 >>>>
 >>>>
 >>>>>>>>>>"d.m &" which is recommended in the welcome message.
 >>>>>>>>>
 >>>>>>>>>>nviz elevation=dem &    # doesn't work
 >>>>>>>>>
 >>>>>>>>>>d.m &            # nviz doesn't work
 >>>>>>>>>
 >>>>>>>>>>nviz elevation=dem    # works!
 >>>>>>>>>
 >>>>>>>>>>d.m            # nviz works!
 >>>>>>>>>
 >>>>>>>>>>And I see nviz prints % prompt. Does anyone have a clue?
 >>>>>>>>>
 >>>>>>>>>It must be the latest change that was done - I just tried it 
and it
 >>>>>>>>
 >>>>>>>>>does not work even if I do nviz elevation=dem, it displays the DEM
 >>>>>>>>
 >>>>>>>>>but fails to open the Main pannel and prints a % prompt.
 >>>>>>>>
 >>>>>>>>>It worked OK just a few days (weeks?) ago.
 >>>>>>>>
 >>>>>>>>>It may be related to the change in the startup script - Bob, 
are you
 >>>>>>>>
 >>>>>>>>>around? How does it work for you?
 >>>>>>>>
 >>>>>>>>>Helena
 >>>>>>>>
 >>>>>>>>>>Thanks.
 >>>>>>>>>
 >>>>>>>>>>Huidae Cho
 >>>>>>>>>
 >>>>>>>>>>_______________________________________________
 >>>>>>>>>
 >>>>>>>>>>grass5 mailing list
 >>>>>>>>>
 >>>>>>>>>>grass5 at grass.itc.it
 >>>>>>>>>
 >>>>>>>>>>http://grass.itc.it/mailman/listinfo/grass5
 >>>>>>>>>
 >>>>>_______________________________________________
 >>>>
 >>>>>grass5 mailing list
 >>>>
 >>>>>grass5 at grass.itc.it
 >>>>
 >>>>>http://grass.itc.it/mailman/listinfo/grass5
 >>>>
 >>>
 >>
 >>--
 >>Bob Covill
 >>
 >>Tekmap Consulting
 >>P.O. Box 2016
 >>Fall River, N.S.
 >>B2T 1K6
 >>Canada
 >>
 >>E-Mail: bcovill at tekmap.ns.ca
 >>Phone: 902-860-1496
 >>Fax: 902-860-1498
 >
 >
 >


-- 
Bob Covill

Tekmap Consulting
P.O. Box 2016
Fall River, N.S.
B2T 1K6
Canada

E-Mail: bcovill at tekmap.ns.ca
Phone: 902-860-1496
Fax: 902-860-1498





More information about the grass-dev mailing list