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='=', vsep=' ') {u's': u'887', u'e': u'88', u'w': u'4', u'n': u'676'} On Mon, Feb 26, 2018 at 9:39 AM, Jonathan Reith <re...@mundialis.de> wrote: > 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 <re...@mundialis.de> 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': '='})) >>> print(compregion) >>> g.region(res="1", flags="p", **compregion) >>> >>> and the output: >>> >>> {u'n': u'5611999 s=5610000 e=32361999 w=32360000 b=159.04 t=206.46'} >>> ERROR: Invalid input <n=5611999 s=5610000 e=32361999 w=32360000 b=159.04 >>> t=206.46> >>> Traceback (most recent call last): >>> File "grass_scripts/error_script.py", line 40, in <module> >>> main() >>> File "grass_scripts/error_script.py", line 38, in main >>> g.region(res="1", flags="p", **compregion) >>> File >>> "/home/jreith/source/grass-7.4.svn/dist.x86_64-pc-linux-gnu/etc/python/grass/pygrass/modules/interface/module.py", >>> line 648, in __call__ >>> return self.run() >>> File >>> "/home/jreith/source/grass-7.4.svn/dist.x86_64-pc-linux-gnu/etc/python/grass/pygrass/modules/interface/module.py", >>> line 769, in run >>> self.wait() >>> File >>> "/home/jreith/source/grass-7.4.svn/dist.x86_64-pc-linux-gnu/etc/python/grass/pygrass/modules/interface/module.py", >>> line 790, in wait >>> module=self.name, errors=stderr) >>> grass.exceptions.CalledModuleError: Module run g.region g.region n=5611999 >>> s=5610000 e=32361999 w=32360000 b=159.04 t=206.46 res=1 -p ended with error >>> Process ended with non-zero return code 1. See errors in the (error) output. >>> ######################### >>> >>> It seems like my last error disappeared, but now I have a new one. >>> >>> running < g.region n=5611999 s=5610000 e=32361999 w=32360000 b=159.04 >>> t=206.46 res=1 -p > from command line in GRASS works just fine. >>> >>> Any help appreciated >>> >>> Jonathan >>> >>> >>> >>> Am 19.02.2018 um 18:49 schrieb Pietro: >>> >>> Thank you Anna I did not noticed the underscor... >>> >>> On 19 Feb 2018 4:41 p.m., "Jonathan Reith" <re...@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. >>> >>> Have fun! >>> >>> Pietro >>> >>> >>> -- >>> Studentische Hilfskraft >>> mundialis GmbH & Co. KG >>> Firmensitz: Kölnstraße 99, 53111 Bonn >>> Registergericht: Amtsgericht Bonn, HRA 8528 >>> >>> vertreten durch: mundialis Verwaltungsgesellschaft mbH >>> Geschäftsführer: >>> Dr. rer. nat. Markus Neteler >>> Dipl.-Geogr. Hinrich Paulsen >>> Dipl.-Geogr. Till Adams >>> >>> Tel. +49 (0)228 - 38 75 80 - 80 >>> Fax. +49 (0)228 - 96 28 99 57 >>> info [at] mundialis [dot] de >>> >>> Internet: www.mundialis.de > > -- > Studentische Hilfskraft > mundialis GmbH & Co. KG > Firmensitz: Kölnstraße 99, 53111 Bonn > Registergericht: Amtsgericht Bonn, HRA 8528 > > vertreten durch: mundialis Verwaltungsgesellschaft mbH > Geschäftsführer: > Dr. rer. nat. Markus Neteler > Dipl.-Geogr. Hinrich Paulsen > Dipl.-Geogr. Till Adams > > Tel. +49 (0)228 - 38 75 80 - 80 > Fax. +49 (0)228 - 96 28 99 57 > info [at] mundialis [dot] de > > Internet: www.mundialis.de > _______________________________________________ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user