<HTML>
<HEAD>
<TITLE>Re: [GRASS-dev] grass and python</TITLE>
</HEAD>
<BODY>
<FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'>Look at the Python cmd module for this.<BR>
<BR>
Michael<BR>
__________________________________________<BR>
Michael Barton, Professor of Anthropology<BR>
School of Human Evolution & Social Change <BR>
Center for Social Dynamics & Complexity<BR>
Arizona State University<BR>
<BR>
phone: 480-965-6213<BR>
fax: 480-965-7671<BR>
www: <a href="http://www.public.asu.edu/~cmbarton">http://www.public.asu.edu/~cmbarton</a> <BR>
<BR>
<BR>
<BR>
<HR ALIGN=CENTER SIZE="3" WIDTH="95%"><B>From: </B>David Finlayson <david.p.finlayson@gmail.com><BR>
<B>Date: </B>Sun, 13 Aug 2006 21:39:33 -0700<BR>
<B>To: </B>Glynn Clements <glynn@gclements.plus.com><BR>
<B>Cc: </B>Trevor Wiens <twiens@interbaun.com>, Michael Barton <michael.barton@asu.edu>, <grass-dev@grass.itc.it>, <William@grass.itc.it>, Kyngesburye <kyngchaos@kyngchaos.com>, <woklist@kyngchaos.com><BR>
<B>Subject: </B>Re: [GRASS-dev] grass and python<BR>
<BR>
The Python interpreter is interactive, but it is not a general purpose shell. You would need to wrap external programs in an os.system or os.popen call. One attractive way of getting around this is to pre-wrap each program in a python object. For example: <BR>
<BR>
class Display:<BR>
<BR>
def rast(self, rastername):<BR>
<BR>
<BR>
<BR>
On 8/12/06, <B>Glynn Clements</B> <glynn@gclements.plus.com <a href="mailto:glynn@gclements.plus.com"><mailto:glynn@gclements.plus.com></a> > wrote:<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'><BR>
Trevor Wiens wrote:<BR>
<BR>
> > If anyone can find a real language which is "good enough" on all of <BR>
> > Unix, Windows (Cygwin and native) and OSX, I'll quite happily rewrite<BR>
> > all of GRASS' shell scripts.<BR>
><BR>
> Python is easy to install on Windows. So with an offer like that, I<BR>
> can't help asking if any of the interactive Python shells are to your <BR>
> knowledge good enough. Or perhaps what in you mind defines an<BR>
> interactive shell environment that is good enough to replace bash?<BR>
<BR>
The main issue is the ability to have scripts which can be run as e.g .<BR>
"d.save", and not having to use "d.save.py <a href="http://d.save.py"><http://d.save.py></a> ". This needs to work both<BR>
from a shell and from system/exec/popen/spawn/etc functions provided<BR>
by various languages. <BR>
<BR>
--<BR>
Glynn Clements <glynn@gclements.plus.com><BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'><BR>
<BR>
<BR>
-- <BR>
David Finlayson<BR>
</SPAN></FONT>
</BODY>
</HTML>