<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 &amp; Social Change &nbsp;&nbsp;&nbsp;<BR>
Center for Social Dynamics &amp; 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 &lt;david.p.finlayson@gmail.com&gt;<BR>
<B>Date: </B>Sun, 13 Aug 2006 21:39:33 -0700<BR>
<B>To: </B>Glynn Clements &lt;glynn@gclements.plus.com&gt;<BR>
<B>Cc: </B>Trevor Wiens &lt;twiens@interbaun.com&gt;, Michael Barton &lt;michael.barton@asu.edu&gt;, &lt;grass-dev@grass.itc.it&gt;, &lt;William@grass.itc.it&gt;, Kyngesburye &lt;kyngchaos@kyngchaos.com&gt;, &lt;woklist@kyngchaos.com&gt;<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>
&nbsp;&nbsp;&nbsp;&nbsp;def rast(self, rastername):<BR>
<BR>
<BR>
<BR>
On 8/12/06, <B>Glynn Clements</B> &lt;glynn@gclements.plus.com &nbsp;<a href="mailto:glynn@gclements.plus.com">&lt;mailto:glynn@gclements.plus.com&gt;</a> &gt; wrote:<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'><BR>
Trevor Wiens wrote:<BR>
<BR>
&gt; &gt; If anyone can find a real language which is &quot;good enough&quot; on all of <BR>
&gt; &gt; Unix, Windows (Cygwin and native) and OSX, I'll quite happily rewrite<BR>
&gt; &gt; all of GRASS' shell scripts.<BR>
&gt;<BR>
&gt; Python is easy to install on Windows. So with an offer like that, I<BR>
&gt; can't help asking if any of the interactive Python shells are to your <BR>
&gt; knowledge good enough. Or perhaps what in you mind defines an<BR>
&gt; 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>
&quot;d.save&quot;, and not having to use &quot;d.save.py <a href="http://d.save.py">&lt;http://d.save.py&gt;</a> &quot;. 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 &lt;glynn@gclements.plus.com&gt;<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>