[GRASS-dev] Error running g.rename from python

Markus Neteler neteler at osgeo.org
Thu Oct 9 23:39:52 PDT 2014


On Fri, Oct 10, 2014 at 8:22 AM, Erick Opiyo <osgis.dev at gmail.com> wrote:
> Dear All,
> Initially I was able to batch rename files in grassdb using the command
> listed below
> g.parse_command("g.rename",rast=old_name,new_name)
> But now I keep getting this error:
> SyntaxError: non-keyword arg after keyword arg

Do you use the development version of GRASS 7 alias trunk?
The syntax is

[neteler at pgis_north grass71]$ cd scripts/
[neteler at pgis_north scripts]$ grep g.rename */*.py
i.in.spotvgt/i.in.spotvgt.py:    grass.run_command('g.rename', rast =
(tmpname, name), quiet = True)
r.fillnulls/r.fillnulls.py:            grass.run_command('g.rename', quiet
= True, rast = (usermask, 'MASK'), overwrite = True)
r.fillnulls/r.fillnulls.py:        grass.run_command('g.rename', quiet =
quiet, rast = ('MASK',usermask))
r.fillnulls/r.fillnulls.py:            if grass.run_command('g.rename',
quiet = quiet, rast = (usermask, 'MASK')) != 0:
r.fillnulls/r.fillnulls.py:                if grass.run_command('g.rename',
rast = (filling + '_tmp', filling),
r.fillnulls/r.fillnulls.py:        if grass.run_command('g.rename', quiet =
quiet, rast = (usermask, 'MASK')) != 0:
r.mask/r.mask.py:            grass.run_command('g.rename', rast = ('MASK',
tmp), quiet = True)
v.rast.stats/v.rast.stats.py:        grass.run_command('g.rename',
rast=(tmpname + "_origmask", 'MASK'),
v.rast.stats/v.rast.stats.py:        grass.run_command('g.rename',
rast=('MASK', tmpname + "_origmask"),

Hope this helps,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20141010/29e10aa8/attachment-0001.html>

More information about the grass-dev mailing list