Thanks a lot for all you helps. Alan your tutorial is very helpful But I have another problem which I will post soon.<br><br><div><span class="gmail_quote">On 2/26/07, <b class="gmail_sendername">Alan Gauld</b> &lt;<a href="mailto:alan.gauld@btinternet.com">
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;Nagendra Singh&quot; &lt;<a href="mailto:singh01@gmail.com">
singh01@gmail.com</a>&gt; wrote<br><br>&gt; Thanks a lot for all the suggestions. I used the function<br>&gt; subprocess.call ( &#39;c:\abc.exe&nbsp;&nbsp;c:\data\file1&#39;), but as before<br>&gt; the command window opens and closes very fast
<br>&gt; a value of 1 is displayed. How do I see the results??<br><br>The result is 1 which indicates an error. You don&#39;t want<br>the result you want the outpur, which is a different thing<br>entirely! :-)<br><br>To get the output you need to access the output stream
<br>of the process which is usually stdout. The old way to do<br>that was with os.popen, but the subprocess module<br>provides a new way. The m,odule docs describe how<br>to replace popen using subprocess&#39; Popen class.
<br><br>My tutorial shows an example of the same thing based<br>on the odule documentation.<br><br>Basically it looks like:<br><br>import subprocess<br>psout = subprocess.Popen(r&#39;c:\abc.exe c:\data\file1&#39;,<br>shell=True, stdout=PIPE).stdout
<br>results = psout.read().split(&#39;\n&#39;)<br>Notice I enclosed the command with a raw string.Otherwise your<br>backslashes get treated as escape characters. This might be why you<br>are getting error codes back?Another way to avoid that is to use
<br>forward slashes which Python understands on DOS psout =<br>subprocess.Popen(&#39;c:/abc.exe c:/data/file1&#39;,<br>shell=True, stdout=PIPE).stdout<br>&gt; I am sorry if I sound dumb.<br><br>Nope, just looking for the wrong thing. But you only
<br>know that after you find out :-)<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">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">Tutor@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a><br></blockquote></div><br>