[GRASS-windows] Creating Python scripts that call GRASS functionality from outside

Glynn Clements glynn at gclements.plus.com
Fri Dec 21 05:30:24 PST 2012


Brian Sanjeewa Rupasinghe wrote:

> I just installed GRASS 6.4.3svn and Python 2.7.3 in Windows 7. I need to
> call GRASS functions from outside GRASS. I set the environment variables
> given
> in the grasswiki except:
> GISRC= C:\Documents and settings\user\.grassrc6
> 
> Because i cannot find this .grassrc6 in the given path or in any other
> path.

A suitable should be created the first time you run GRASS.
Alternatively, you can create the file yourself, e.g.:

GISDBASE: /opt/grass-data
LOCATION_NAME: spearfish57
MAPSET: user1
GRASS_DB_ENCODING: ascii

> However with other variables, i tried to use from grass.lib
> importgrass in Python27 IDLE. Then it gives an error. I think the
> variables are
> not set correctly. Could somebody help me to sort this out?

If GISRC doesn't refer to a valid settings file, nothing will work.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-windows mailing list