[GRASS-user] Second try, run grass scripts as batch process in Windows

Moritz Lennert mlennert at club.worldonline.be
Thu Sep 25 04:29:50 EDT 2008


On 25/09/08 09:53, Kris Nackaerts wrote:
> Dear,
> 
> This is a quite confusing discussion for a newcomer. People talk about a 
> 'shell' and batch commands which seems to have different meanings.
> 
> I do like/prefer the Python approach. But again here, I found out there 
> seems to be Python scripts for GRASS that have to be run from within 
> 'the GRASS environment'?

'within the GRASS environment' just means that a series of environmental 
variables have to be set allowing the different GRASS modules to find 
what they need and that you need to define which location and mapset you 
are working in.

So, as long as you set these variables, you should be able to launch any 
GRASS command from a python script. "Starting" GRASS and then launching 
your script just does this for you automatically, but it also creates a 
new shell, and so you cannot use this automatic start for batch jobs.

See

http://grass.osgeo.org/wiki/GRASS_and_Shell
http://grass.osgeo.org/wiki/GRASS_and_Python

There is a python library in the GRASS code which should help you write 
scripts:

http://trac.osgeo.org/grass/browser/grass/trunk/lib/python

Moritz


More information about the grass-user mailing list