[GRASS-dev] Re: gis.m crashes on zoom to map existing in more than one mapset

Michael Barton michael.barton at asu.edu
Thu Jan 4 11:23:45 EST 2007




On 1/4/07 8:47 AM, "Moritz Lennert" <mlennert at club.worldonline.be> wrote:

Moritz and Paul,

The following construction will trap errors in TclTk, but it doesn't help
this particular issue.

    if {![catch {open [concat "|g.region" "-ugp" $args] r} input]} {
        while {[gets $input line] >= 0} {
            regexp -nocase {^([a-z]+)=(.*)$} $line trash key value
            set parts($key) $value
        }
....

If there if no error, "catch" returns 0 and the routine goes on.
If there is an error, "catch" returns a value >0 and the error message is
stored in the variable "input". Input can be printed to the terminal or to a
TclTk dialog if desired.

This is trapping errors fine as far as I can tell. Try getting rid of
libgdal (which produces an error if you run g.region) and running the GUI.
It will exit with a message to the terminal.

In this case, the warning in g.region -g seems to be part of the command
output rather than a valid error message. I don't know why.

Michael

> On 04/01/07 16:18, Michael Barton wrote:

>> Moritz,
>> 
>> Yes, this warning will again break the GUI. This seems like a warning that
>> is not terribly useful. So what if a map with the same name exists in
>> another mapset? 
>> 
>> May I suggest that the -g flag, which means print in shell *SCRIPT* format,
>> does exactly that--print the output in a format that can easily be parsed by
>> scripts. A warning at the beginning of output for scripting cannot easily be
>> parsed. The warning should be for the format that is to be read by humans.
>> Any warnings or similar messages should be surpressed in scripting output
>> format.
> 
> I don't necessarily agree that warnings should not be printed in
> scripts. I would rather argue with Paul that scripts should be made in a
> way to deal with such issues more robustly.
> 
>> 
>> Even for humans, I'm not sure that this particular warning is especially
>> useful. What is it "warning" about? The design of independent mapsets, with
>> the option of "name at MAPSET" construction permits maps of the same name to
>> reside in different mapsets of the same location.
> 
> Personally I have never found it useful, but it might be useful to some
> as a reminder, in order to make sure that they are really working on the
> map they want to work on. But then this should probably read something
> like: "Map exists in several mapsets. Currently working with map at XXX."
> 
> Moritz
> 
>> 


__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton





More information about the grass-dev mailing list