Dear All,

I'm trying to start grass grass without starting it explicitly on
windows, but it is not working, I've attached the script that works on
linux... in windows the result of the script is:

C:\Program Files (x86)\GRASS GIS 7.0.svn\extrabin\python.exe
{}

the first line is the path to the python interpreter in use and the
dictionary is the result of the script.core.region function.

Why is not working?
How can I fix this?

Pietro
# -*- coding: utf-8 -*-
######################## START GRASS #########################
import os
import sys

## set PATHs
if sys.platform.startswith('linux'):
    TRUNK = r'/home/pietro/docdat/src/gis/grass/grass_trunk'
    GISBASE = os.path.join(TRUNK, r'dist.x86_64-unknown-linux-gnu')
    # set the path to the GRASS data
    GISDBASE = (r'/home/pietro/docdat/phd/pubblicazioni/eurac/'
                'corso/GIS/workshop-pygrass')
elif sys.platform.startswith('win'):
    GISBASE = r'C:\Program Files (x86)\GRASS GIS 7.0.svn'
    ## set the path to the GRASS data
    GISDBASE = r'C:\Users\Pietro\Desktop\GRASS_FILE'
    os.environ['GRASS_SH'] = os.path.joinjoin(GISBASE, 'msys', 'bin', 'sh.exe')
else:
    OSError('Platform not configured.')

LOCATION = r'ncb7'
MAPSET = r'user1'


## set environmental variables
os.environ['GISBASE'] = GISBASE

## add GRASS python lib to the PYTHON_PATH
sys.path.append(os.path.join(GISBASE, 'etc', 'python'))

## import the setup module
from grass.script.setup import init as ginit

## call the init function
ginit(GISBASE, GISDBASE, LOCATION, MAPSET)
######################## START SCRIPT ########################
from pprint import pprint
from grass import script

## check which python we are using
print(sys.executable)

## get the mapset region
pprint(script.region())
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to