[GRASS-user] python parse_command

Markus Neteler neteler at osgeo.org
Wed Feb 21 02:56:02 PST 2018


On Mon, Feb 19, 2018 at 6:49 PM, Pietro <peter.zamb at gmail.com> wrote:
> On 19 Feb 2018 4:41 p.m., "Jonathan Reith" <reith at mundialis.de> wrote:
>
>   print(compregion)
>   g.region(compregion,res="1", flags="p")
>
> you are hassling the dictionary to a region, but you have to unpack the
> dictionary just write:
>
> ...
>
> g.region(res="1", flags="p", **compregion)
>
> the two * unpack the dictionary.

Thanks for the hint: I have turned it into a Wiki snippet at
https://grasswiki.osgeo.org/wiki/GRASS_Python_Scripting_Library#Example_for_parsing_the_region_output_of_a_module

Please update directly there if needed.

Markus


More information about the grass-user mailing list