grass going to python scripting (was Re: [GRASS-user] new module: r.surf.volcano)

Michael Barton michael.barton at asu.edu
Tue Apr 21 01:02:04 EDT 2009


GRASS doesn't really support or not support any platform with respect to
scripting. The nice thing about modular GRASS is that you can call its
modules from many different scripting and programming platforms.

So AFAIK, GRASS will continue to work with bash on platforms that support
it--primarily Linux and Unix.

However, we are using Python for the GUI now and Python has a number of
advantages over bash for scripting. It is a full-featured programming
language and hence more powerful than bash. It is also very cross-platform
and will run on more OS platforms than bash. So we'd like to encourage users
to begin writing scripts in Python. A single platform for scripts that are
distributed in the GRASS package will make it easier for users to understand
what they do and to improve them. That doesn't mean that you cannot create
scripts unless they are in Python. But I'd encourage you to give Python a
try. It's pretty nice. Even I was able to learn it pretty quickly.

Michael


On 4/20/09 6:50 PM, "maning sambale" <emmanuel.sambale at gmail.com> wrote:

> another possible stupid questions:
> Am I right that GRASS 7 will use Python as the scripting language,
> therefore, unix shell scripting won't be supported anymore?
> Should I start learning Python now?  Should I port my scripts to Python?
> Will a new GRASS book include Python script samples?
> 
> On Tue, Apr 21, 2009 at 4:36 AM, Hamish <hamish_b at yahoo.com> wrote:
>> 
>> Dylan Beaudette wrote:
>>> Possible stupid question: do we have a standardized Python
>>> script template, something like the old shell-style template?
>> 
>> Possible stupid answer: because unix scripting and python both
>> use '#' as the comment character, 'g.module --script' will create
>> a script template for both exactly the same. just change the
>> shebang line at the top from /bin/sh to /bin/python or whatever
>> that has to be and also replace the "are we already in grass?"
>> shell-style check at the end.
>> 
>> and of course reuse from the other python scripts in (mostly)
>> grass7's scripts/ dir as a good guide for setting up temp files
>> and other common but subtle tasks.
>> 
>> 
>> Hamish
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> grass-user mailing list
>> grass-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>> 
> 
> 

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton




More information about the grass-user mailing list