[GRASS-dev] pygrass - r.report

Hi,

when using pyGRASS, the statement bellow

"""
from grass.pygrass.modules.shortcuts import raster as r

r.report(map = 'r_ndvi', units = 'c,p,h')
"""

produces an error

Traceback (most recent call last):
  File "/home/martin/bin/grass/ndvi.py", line 34, in <module>
    r.report(map = 'r_ndvi', units = 'c,p,h')
  File "/opt/src/grass_trunk/dist.x86_64-unknown-linux-gnu/etc/python/grass/pygrass/modules/interface/module.py",
line 342, in __call__
    self.inputs[key].value = val
  File "/opt/src/grass_trunk/dist.x86_64-unknown-linux-gnu/etc/python/grass/pygrass/modules/interface/parameter.py",
line 115, in _set_value
    (self.name, self.values))
ValueError: The Parameter <units>, must be one of: ['mi', 'me', 'k',
'a', 'h', 'c', 'p']

Is it a bug in pyGRASS or I am wrong? Thanks, Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hi Martin,

On Thu, Oct 17, 2013 at 11:34 AM, Martin Landa <landa.martin@gmail.com> wrote:

Is it a bug in pyGRASS or I am wrong?

Thank you for using and testing... :slight_smile:
It is working, at least on my pc. The pygrass Module interface require
tu give a python list if you have a multiple parameter, so your code
should work writing:

{{{
from grass.pygrass.modules.shortcuts import raster as r

r.report(map='r_ndvi', units=['c', 'p', 'h'])
}}}

Please, let me know...

Have a nice day.

Pietro

Hi Pietro,

2013/10/17 Pietro <peter.zamb@gmail.com>:

{{{
from grass.pygrass.modules.shortcuts import raster as r

r.report(map='r_ndvi', units=['c', 'p', 'h'])
}}}

Please, let me know...

right, sorry for the noise :slight_smile: Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

On Thu, Oct 17, 2013 at 11:34 AM, Martin Landa <landa.martin@gmail.com> wrote:

ValueError: The Parameter <units>, must be one of: ['mi', 'me', 'k', 'a', 'h', 'c', 'p']

Perhaps If I can change the error string in something more explicit like:

ValueError: The Parameter <units>, must be a python list containing
one of the following values: ['mi', 'me', 'k', 'a', 'h', 'c', 'p']

What do you think?

Pietro

On Thu, Oct 17, 2013 at 11:59 AM, Pietro <peter.zamb@gmail.com> wrote:

ValueError: The Parameter <units>, must be a python list containing
one of the following values: ['mi', 'me', 'k', 'a', 'h', 'c', 'p']

Maybe this is better:

ValueError: The Parameter <units>, must be a python list containing
one or more of the following values: ['mi', 'me', 'k', 'a', 'h', 'c', 'p']

Pietro

2013/10/17 Pietro <peter.zamb@gmail.com>:

Maybe this is better:

ValueError: The Parameter <units>, must be a python list containing
one or more of the following values: ['mi', 'me', 'k', 'a', 'h', 'c', 'p']

+1, Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

+1

Yann

···

On 17 October 2013 16:41, Martin Landa <landa.martin@gmail.com> wrote:

2013/10/17 Pietro <peter.zamb@gmail.com>:

Maybe this is better:

ValueError: The Parameter , must be a python list containing
one or more of the following values: [‘mi’, ‘me’, ‘k’, ‘a’, ‘h’, ‘c’, ‘p’]

+1, Martin


Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev