[GRASS-user] 6.4 vs 7.0

Glynn Clements glynn at gclements.plus.com
Sun Jan 17 01:14:05 EST 2010

Hamish wrote:

> > echo "UPDATE polyNoTopology \
> >   SET label='poly$a' WHERE cat=$index" | db.execute ##works
> > in GRASS 6.4; in 7.0 I need:
> > echo "UPDATE polyNoTopology \
> >   SET label='poly$a' WHERE cat=$index" | db.execute in=-
> here "input=" has been set to be a required input. AFAIU this is so the
> option appears on the first tab of the module GUI window ("Required").
> I've complained about that before, so won't repeat myself, but what is
> really needed IMO is a new item added somewhere to help order the GUI
> sections so these GUI-at-the-expense-of-the-CLI hacks can be avoided.

Regardless of how it affects the GUI, I really can't accept that
having to add " in=-" is a significant burden.

IMHO, we should just fix 6.4's db.execute to accept in=-. Allowing it
provides forward-compatibility with 7.0 without breaking backward
compatibility with 6.3/6.4-SVN. Ditto for v.in.ascii and anything else
which is capable of reading from stdin.

If it helps, I could add G_open() and G_fopen() which accept "-" as a
valid filename (meaning stdin for read, stdout for write; obviously
read-write access won't work with "-").

> > (ok: perhaps python scripting should be a solution; I'm trying...)
> fwiw, that won't help much if the module options change. I guess the
> verbose and overwrite stuff will be automatically handled by the grass.py
> package, and command line options passed as a single expression won't be
> treated like an option, so yes actually python could help in some cases.
> just be sure to use the grass.package and not just make system() calls.

grass.script.run_command() etc can't handle 6.x's r.mapcalc. However,
grass.script.mapcalc() can (it passes the expression via stdin rather
than on the command line), although it doesn't offer control over the
overwrite, quiet and verbose options. That could be changed, though.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-user mailing list