[GRASS-user] Problem using python to create GRASS mapset

Anna Petrášová kratochanna at gmail.com
Mon Mar 31 10:17:56 PDT 2014


On Mon, Mar 31, 2014 at 1:10 PM, Heinz Chen <liebenhans at gmail.com> wrote:

>  Sorry for asking questions to just helping me debug my python script, but
> I really can't find where to be edited, and here's my script to generate
> new mapset,
>
> import osimport sys
> #set up GRASS environment variables
> sys.path.append(os.path.join(os.environ['GISBASE'], 'etc', 'python'))import grass.script as gimport grass.script.setup as gsetup
> #create new mapset in the location
> g.run_command('g.mapset' '-c' , mapset = 'watershed_analysis', location = 'newLocation', gisdb = 'C:\Users\Heinz\Documents\grassdata')
> #check resultprint g.read_command('g.mapsets' '-l')
>
>  The script runs fine but with no output, what mistake did I make?
>
> I am using GRASS 6.4.3, python 2.7 under Windows 8.1
>
> How about:

 g.run_command('g.mapset', flags='c' , mapset = 'watershed_analysis',
location = 'newLocation', gisdb = r'C:\Users\Heinz\Documents\grassdata')

print g.read_command('g.mapsets', flags='l')


Anna

> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20140331/07c602d3/attachment-0001.html>


More information about the grass-user mailing list