[GRASS-dev] problem with parse_command python

Glynn Clements glynn at gclements.plus.com
Thu Dec 23 13:14:59 EST 2010


Luca Delucchi wrote:

> Hi all, I'm working for a new module using python but I have a strange
> problem with parse_command and v.what. When I have a "good dictionary"
> (setting parse = (grass.parse_key_val, { 'sep' : ':' })) I can see
> only the attributes of one feature, with a "bad dictionary" I see all
> the features but I can't work with them

> I also try to use flags = 'ag', but I can only have the second
> solution (with one features)
> 
> Is there a problem in parse_command or I do something wrong?

parse_key_val returns a dictionary, so the keys must be unique. If you
have duplicate keys, only the last value will be returned.

For v.what, you'll need to parse the output yourself.

For the future, we should consider fixing v.what to use a sane (i.e. 
non-modal) output format for -g.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list