[GRASS-dev] still problems with overwrite in scripts
Michael Barton
michael.barton at asu.edu
Wed Jun 27 21:06:05 PDT 2012
Hmmm. This should have worked. But...
The options (copied from another script) are written as...
#%option G_OPT_R_INPUT
#% key: ms3
#% description: Input raster map for red channel
#%end
So there is no way to add "new" unless I redo the options section. This way of doing the interface is new, but I thought that maybe it is the desired approach for Python now.
I added "#% overwrite: yes" by itself,
as...
#%option
#% overwrite: yes
#%end
and as another line in an existing option section
In all cases, it generated an error.
Suggestions?
Michael
On Jun 27, 2012, at 5:06 PM, Glynn Clements wrote:
>
> Michael Barton wrote:
>
>> I thought from reading past mail posts that -o and --o and --overwrite
>> all set the overwrite flag.
>
> The last two do; the first one is just a normal flag.
>
> Historically, modules used -o for overwrite, but that is deprecated in
> favour of the --o/--overwrite option which is built into G_parser().
>
>> I test for overwrite with grass.overwrite()
>>
>> But how do I include a check box for the overwrite flag in the GUI specs
>> (for g.parser)?
>
> If any of the options have a gisprompt setting which starts with
> "new", the --help output will display the --o flag and the GUI will
> have a checkbox to enable overwrite.
>
> In 7.0, you can force the existence of the overwrite flag by adding
> "#% overwrite: yes" to the module options, but this doesn't work in
> 6.x, partly because it isn't implemented in g.parser and partly
> because the underlying logic in G_parser() is broken; see:
>
> https://trac.osgeo.org/grass/ticket/1658#comment:1
>
> --
> Glynn Clements <glynn at gclements.plus.com>
_____________________
C. Michael Barton
Visiting Scientist, Integrated Science Program
National Center for Atmospheric Research &
University Consortium for Atmospheric Research
303-497-2889 (voice)
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
More information about the grass-dev
mailing list