On 2/26/07, <b class="gmail_sendername">Nagendra Singh</b> &lt;<a href="mailto:singh01@gmail.com">singh01@gmail.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks a lot for all the suggestions. I used the function subprocess.call ( &#39;c:\abc.exe&nbsp; c:\data\file1&#39;), but as before the command window opens and closes very fast a value of 1 is displayed. How do I see the results??&nbsp; I am sorry if I sound dumb.
<br><span class="sg"><br>Singh</span><div><span class="e" id="q_110fef4695f783d9_2"><br><br><div><span class="gmail_quote">On 2/23/07, <b class="gmail_sendername">Alan Gauld</b> &lt;<a href="mailto:alan.gauld@btinternet.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
alan.gauld@btinternet.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>&quot;Rikard Bosnjakovic&quot; &lt;<a href="mailto:rikard.bosnjakovic@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rikard.bosnjakovic@gmail.com</a>&gt; wrote<br><br>&gt;&gt; How can I get python to display
<br>&gt;&gt; the results in the interactive window or what is the right way to
<br>&gt;&gt; do this.<br>&gt;<br>&gt; Use os.popen:<br><br>As Rikard, Richard and Hugo have pointed out there are<br>numerous ways to do this in Python.<br><br>The officially sanctioned way nowadays is to use the subprocess
<br>module. It supercedes all tthe previous methods being both more<br>powerful, more flexible and fairly easy to use.<br><br>All the techniques are discussed in my Using the OS topic in<br>my tutorial.<br><br>HTH,<br><br>

--<br>Alan Gauld<br>Author of the Learn to Program web site<br><a href="http://www.freenetpages.co.uk/hp/alan.gauld" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.freenetpages.co.uk/hp/alan.gauld
</a><br><br><br>_______________________________________________
<br>Tutor maillist&nbsp;&nbsp;-&nbsp;&nbsp;<a href="mailto:Tutor@python.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Tutor@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://mail.python.org/mailman/listinfo/tutor</a><br></blockquote></div><br>
</span></div><br>_______________________________________________<br>Tutor maillist &nbsp;- &nbsp;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Tutor@python.org">Tutor@python.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">
http://mail.python.org/mailman/listinfo/tutor</a><br><br></blockquote></div><br>I am not a big user of python, hence the username, however I used the os.popen command as suggested by Rikard<br>
<br>
In the shell:<br>
<br>
data = os.popen(&#39;ls&#39;)<br>
type(data)<br>
&nbsp;&nbsp;&nbsp; &lt;type &#39;file&#39;&gt;<br>
Then a loop over the data object<br>
for f in data:<br>
&nbsp;&nbsp;&nbsp; print f<br>
<br>
seemed to do the job.<br>
<br>
I did notice that I could not capture the information to a var using the subprocess call - I HAVE NOT READ THE DOCs (yet) - a quick look suggested that this *should* work<br>
<br>
The call I made using subprocess<br>
from subprocess import call<br>
foo = call(&quot;ls&quot;)<br>
&nbsp; &lt;PRINTS CONTENTS OF /HOME/&gt;<br>
&nbsp; &lt;FOO IS == 0 &gt;<br>
<br><br>