[GRASS-user] Using GRASS 6 without starting it (Python)

Pedro Camargo veigacamargo at gmail.com
Fri Mar 6 08:16:06 PST 2015


Hi,
       I have been trying to use GRASS without opening it explicitly
following the instructions from here:
http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Python:_GRASS_GIS_6

      Since I am on Windows, I had to adapt it a bit (and I tried many,
many variations).  The most likely


import os
import sys
location = "AZ"
mapset   = "AZMAP"
gisbase = os.environ['GISBASE'] = "C:/Program Files/QGIS
Valmiera/apps/grass/grass-6.4.3"
sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "python"))
gisdbase = os.path.join(os.getenv('APPDATA', 'GRASS6/grassrc6'))
import grass.script as grass
import grass.script.setup as gsetup
gsetup.init(gisbase, gisdbase, location, mapset)


What I get when I run these lines is the line below:

'c:\\users\\pcamargo\\appdata\\local\\temp\\tmp7wvogg'


The content of this file is

GISDBASE: C:/Users/pcamargo/AppData/Roaming/GRASS6/grassrc6
LOCATION_NAME: AZ
MAPSET: AZMAP

While it should be getting the contents from the file at
C:\Users\pcamargo\AppData\Roaming\GRASS6\grassrc6


What am I doing wrong?

Thanks,

Pedro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20150306/281e5e12/attachment.html>


More information about the grass-user mailing list