[GRASS-dev] using g.mapset in python script

Paulo van Breugel p.vanbreugel at gmail.com
Sun Dec 24 06:10:05 PST 2017

Hi devs,

I am trying to create a new mapset and open that mapset using g.mapset. 
When doing this from the command line, I can import layers in the new 
mapset using r.in.gdal without problems.However, running this in a 
python script doesn't work. E.g., when I run:

gs.run_command("g.mapset", flags="c", mapset="LST", location="latlon_clark66")

Next, I try to import a layer:



gs.run_command("r.in.gdal", input=infile, output=outfile)

This gives me the error:

gs.run_command("r.in.gdal", input="lst_01.tif", output="lst_01")

Traceback (most recent call last):

   File "<ipython-input-18-2c415e16d79f>", line 1, in <module>

     gs.run_command("r.in.gdal", input="lst_01.tif", output="lst_01")

   File "/usr/local/grass7/grass-7.5.svn/etc/python/grass/script/core.py", line 421, in run_command

     return handle_errors(returncode, returncode, args, kwargs)

   File "/usr/local/grass7/grass-7.5.svn/etc/python/grass/script/core.py", line 332, in handle_errors


CalledModuleError: Module run None ['r.in.gdal', 'input=lst_01.tif', 'output=lst_01'] ended with error

Process ended with non-zero return code 1. See errors in the (error) output.

Any idea why this doesn't work?

Best wishes,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20171224/57038676/attachment.html>

More information about the grass-dev mailing list