[GRASS-dev] g.copy with pygrass

Hi,

Not sure I am doing something wrong, but in pygrass the example from https://grasswiki.osgeo.org/wiki/Python/pygrass#Interface_to_copying_maps_.28g.copy.29 to copy a raster doesn't work for me.

from grass.pygrass.modules.shortcuts import general as g

vectinmap = 'MASK'

vectoutmap = 'TMP'

g.copy(raster="%s,%s" % (vectinmap,vectoutmap) )

Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/local/grass7/grass-7.1.svn/etc/python/grass/pygrass/modules/interface/module.py", line 564, in __call__
     self.inputs[key].value = val
   File "/usr/local/grass7/grass-7.1.svn/etc/python/grass/pygrass/modules/interface/parameter.py", line 184, in _set_value
     self._value, self._rawvalue = _check_value(self, value)
   File "/usr/local/grass7/grass-7.1.svn/etc/python/grass/pygrass/modules/interface/parameter.py", line 66, in _check_value
     raise TypeError(msg % (param.name, param.keydescvalues))
TypeError: The Parameter <raster> require multiple inputs in the form: ('from', 'to')

However, this works:

vectinmap = 'MASK'

vectoutmap = 'TMP'

g.copy(raster=(vectinmap,vectoutmap))

Btw, the parameter rast in the example should be raster.

Hi Paulo,

On Tue, Mar 29, 2016 at 10:51 AM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

from grass.pygrass.modules.shortcuts import general as g

vectinmap = 'MASK'
vectoutmap = 'TMP'
g.copy(raster="%s,%s" % (vectinmap,vectoutmap) )

Indeed this is wrong and I fix it.

Please feel free to edit the wiki page if you found other errors.

All the best.

Pietro