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

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@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@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

--
cheers,
maning
------------------------------------------------------
"Freedom is still the most radical idea of all" -N.Branden
wiki: http://esambale.wikispaces.com/
blog: http://epsg4253.wordpress.com/
------------------------------------------------------

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@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@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@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

Thanks Michael

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

This gives me a sigh of relief at the moment

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.

I learned shell scripting primarily because of GRASS. Probably now is
the time to start learning Python (for GRASS, QGIS and R). A
beginners tutorial would be an excellent material to lessen the
barrier. Just like Chapter 9.2 of the GRASS book.

--
cheers,
maning
------------------------------------------------------
"Freedom is still the most radical idea of all" -N.Branden
wiki: http://esambale.wikispaces.com/
blog: http://epsg4253.wordpress.com/
------------------------------------------------------

2009/4/21 maning sambale <emmanuel.sambale@gmail.com>:

Thanks Michael

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

This gives me a sigh of relief at the moment

+1

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.

I learned shell scripting primarily because of GRASS. Probably now is
the time to start learning Python (for GRASS, QGIS and R). A
beginners tutorial would be an excellent material to lessen the
barrier. Just like Chapter 9.2 of the GRASS book.

+1

I am totally agree with you.
There are excellent python tutorials but a brief introduction on how
doing same simply and common task in Grass with python would be
great.

ciao
--
--
Paolo C.
Lat. 44° 39' 11.08'' N Long. 7° 23' 25.26'' E

maning sambale wrote:

Am I right that GRASS 7 will use Python as the scripting language,
therefore, unix shell scripting won't be supported anymore?

As Michael says, you can script GRASS in any language which has the
ability to run commands.

But we're trying to replace the shell scripts which are included in
GRASS with Python versions. Apart from anything else, there are a lot
of issue with shell scripts on Windows.

Should I start learning Python now?

Yes.

Should I port my scripts to Python?

Yes, if you want them to be portable, or might eventually want them to
be included as part of GRASS, or if they're complex.

Unix shells tend to be poor programming languages, as they are
designed for interactive use first, and scripting second.

The only reason anyone chooses the Bourne shell as a programming
language is because every Unix system has it. But if you want
portability to Windows, that's no longer an advantage.

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