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 os
import sys
#set up GRASS environment variables
sys.path.append(os.path.join(os.environ['GISBASE'], 'etc', 'python'))
import grass.script as g
import 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 result
print 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
On Mon, Mar 31, 2014 at 1:10 PM, Heinz Chen <liebenhans@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@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user