Re: [GRASS-user] python parse_command

2018-02-27 Thread Markus Neteler
On Mon, Feb 26, 2018 at 3:49 PM, Jonathan Reith wrote: > Ok, now it works. Thanks a lot. My test-file made some problems, but now > it finally works :) Great! I have updated the Wiki code snippet to a working example https://grasswiki.osgeo.org/wiki/GRASS_Python_Scripting_Library#Example_for_par

Re: [GRASS-user] python parse_command

2018-02-26 Thread Jonathan Reith
Ok, now it works. Thanks a lot. My test-file made some problems, but now it finally works :) Am 26.02.2018 um 15:42 schrieb Anna Petrášová: > When I try this: > > grass.parse_key_val('n=676 s=887 e=88 w=4', sep='=') > > I get: > > {u'n': u'676 s=887 e=88 w=4'} > > which is what you are getting. B

Re: [GRASS-user] python parse_command

2018-02-26 Thread Anna Petrášová
When I try this: grass.parse_key_val('n=676 s=887 e=88 w=4', sep='=') I get: {u'n': u'676 s=887 e=88 w=4'} which is what you are getting. But with adding space as vsep, I get correct results, so it should work. Are you sure you used space there? grass.parse_key_val('n=676 s=887 e=88 w=4', sep=

Re: [GRASS-user] python parse_command

2018-02-26 Thread Jonathan Reith
Nope, still the same error Am 26.02.2018 um 15:35 schrieb Anna Petrášová: > Would > > parse=(grass.parse_key_val, {'sep': '=', 'vsep': ' '})) > > help? > > On Mon, Feb 26, 2018 at 4:53 AM, Jonathan Reith wrote: >> Ok. So now my code is: >> >> compregion = grass.parse_command("r.in.xyz", inpu

Re: [GRASS-user] python parse_command

2018-02-26 Thread Anna Petrášová
Would parse=(grass.parse_key_val, {'sep': '=', 'vsep': ' '})) help? On Mon, Feb 26, 2018 at 4:53 AM, Jonathan Reith wrote: > Ok. So now my code is: > > compregion = grass.parse_command("r.in.xyz", input=xyz, > separator="space", flags="sg", output="bbox",parse=(grass.parse_key_val, > {'sep'

Re: [GRASS-user] python parse_command

2018-02-26 Thread Jonathan Reith
Ok. So now my code is:     compregion = grass.parse_command("r.in.xyz", input=xyz, separator="space", flags="sg", output="bbox",parse=(grass.parse_key_val, {'sep': '='}))     print(compregion)     g.region(res="1", flags="p", **compregion) and the output: {u'n': u'5611999 s=561 e=32361999 w=

Re: [GRASS-user] python parse_command

2018-02-21 Thread Markus Neteler
On Mon, Feb 19, 2018 at 6:49 PM, Pietro wrote: > On 19 Feb 2018 4:41 p.m., "Jonathan Reith" 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",

Re: [GRASS-user] python parse_command

2018-02-19 Thread Pietro
Thank you Anna I did not noticed the underscor... On 19 Feb 2018 4:41 p.m., "Jonathan Reith" 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", **c

Re: [GRASS-user] python parse_command

2018-02-19 Thread Jonathan Reith
Ok, now I understood the problem, thanks a lot Anna But I'm still struggling with the parse_command and r.in.xyz code-example:   compregion = grass.parse_command("r.in.xyz",input="tmp.xyz", separator="space", flags="sg", output="bbox", parse=(grass.parse_key_val,

Re: [GRASS-user] python parse_command

2018-02-19 Thread Anna Petrášová
On Mon, Feb 19, 2018 at 4:36 AM, Jonathan Reith wrote: > thanks for the answers, but this did not work. > > Again, here is my code, this time not just the minimum version: > > #!/usr/bin/env python > import os > from grass_session import Session > from grass.script import core as gcore > > from gr

Re: [GRASS-user] python parse_command

2018-02-19 Thread Jonathan Reith
thanks for the answers, but this did not work. Again, here is my code, this time not just the minimum version: #!/usr/bin/env python import os from grass_session import Session from grass.script import core as gcore from grass.pygrass.modules.shortcuts import general as g from grass.pygrass.modu

Re: [GRASS-user] python parse_command

2018-02-12 Thread Anna Petrášová
Isn't the problem that you have there r.in_xyz instead of r.in.xyz? Anna On Feb 12, 2018 9:35 AM, "Pietro" wrote: Dear Jonathan, the error is due to grass_session that is not creating the location if missing. I don't have time in this day to fix this issue in grass_session, so the fastest fsol

Re: [GRASS-user] python parse_command

2018-02-12 Thread Pietro
Dear Jonathan, the error is due to grass_session that is not creating the location if missing. I don't have time in this day to fix this issue in grass_session, so the fastest fsolution at the momenth is to check and create what is needed step by step. I did not have xyz file to test so I've only