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; def rast(self, rastername):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os.system(&quot;d.rast %s&quot; % rastername)<br><br>Then the syntax in the Python interpreter would be:<br><br>&gt; import Display<br>&gt; d = Display.display
()<br>&gt; d.rast(rastername)<br><br>Which isn't so bad. This is what things would look like in PyShell (or PyCrust) which is a wxWindows-compatible python interpreter that you can use in wxWindows GUI's.<br><br>The most advanced Python interpreter is IPython. This has been tweaked for interactive use by the Scipy (numeric programming) folks so that some of the Python decorations can be dropped in the above example:
<br><br>&gt; import Display<br>&gt; d = Display.display()<br>&gt; d.rast rastername<br><br>No more parenthesis needed. Also, IPython has &quot;magic&quot; operators that allow you to &quot;shell-out&quot; to the underlying shell. Simply prepend a command with a % and it will bypass the python interpreter and send it to the shell:
<br><br>&gt; %ls<br><br>or<br><br>&gt;%dir<br><br>The IPython interpreter is designed for interactive use. It is the Scipy answer to Matlab's interactive prompt. It has a lot of nice shell-like features and can be extended for use by GRASS (I think). Unfortunately, I don't think IPython is as well integrated with Windows as Unix. At least on my casual observations.
<br><br>David<br><br><div><span class="gmail_quote">On 8/13/06, <b class="gmail_sendername">David Finlayson</b> &lt;<a href="mailto:david.p.finlayson@gmail.com">david.p.finlayson@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>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; def rast(self, rastername):</div><div><span class="e" id="q_10d0afa3a1e857d8_1"><br><br><br><br><div><span class="gmail_quote">On 8/12/06, <b class="gmail_sendername">Glynn Clements</b> &lt;
<a href="mailto:glynn@gclements.plus.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">glynn@gclements.plus.com
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><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;<a href="http://d.save.py" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">d.save.py</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;<a href="mailto:glynn@gclements.plus.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">glynn@gclements.plus.com</a>&gt;<br></blockquote></div><br><br clear="all">
<br></span></div><div>-- <br></div><div><span class="sg">David Finlayson

</span></div></blockquote></div><br><br clear="all"><br>-- <br>David Finlayson