Thank you for the prompt response.<br><br>Yeah, I missed out one line at the end of the error, the whole of which is:<br><br>Traceback (most recent call last):<br>  File "process.py", line 18, in <module><br>
    retval = subprocess.call(comd, 0, None, None, outptr, errptr)<br>  File "/usr/lib/python2.5/subprocess.py", line 443, in call<br>    return Popen(*popenargs, **kwargs).wait()<br>  File "/usr/lib/python2.5/subprocess.py", line 593, in __init__<br>
    errread, errwrite)<br>  File "/usr/lib/python2.5/subprocess.py", line 1135, in _execute_child<br>    raise child_exception<br>OSError: [Errno 2] No such file or directory<br><br>Looking forward to any kind of help or suggestion in this regard.<br>
Thanks.<br><br><div class="gmail_quote">On Tue, Dec 23, 2008 at 7:00 AM, Chris Rebert <span dir="ltr"><<a href="mailto:clp@rebertia.com">clp@rebertia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Mon, Dec 22, 2008 at 2:02 AM, ANURAG BAGARIA<br>
<<a href="mailto:anurag.bagaria@gmail.com">anurag.bagaria@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
> I am a Python Newbie and would like to call a short python script via<br>
> browser using a CGI script, but initially I am trying to call the same<br>
> python script directly through python command line. The script intends to<br>
> perform a few command line in a pipe and I have written the script (a short<br>
> one) as follows.<br>
><br>
> #!/usr/bin/python<br>
><br>
> import cgi, string, os, sys, cgitb, commands, subprocess<br>
> import posixpath, macpath<br>
> #file = "x.tar.gz"<br>
> #comd = "tar -xf %s" % (file)<br>
> #os.system(comd)<br>
> #commands.getoutput('tar -xf x.tar.gz | cd demo; cp README ../')<br>
> comd = [\<br>
>         "tar -xf x.tar.gz", \<br>
>         "cd demo", \<br>
>         "cp README ../", \<br>
>       ]<br>
> outFile = os.path.join(os.curdir, "output.log")<br>
> outptr = file(outFile, "w")<br>
> errFile = os.path.join(os.curdir, "error.log")<br>
> errptr = file(errFile, "w")<br>
> retval = subprocess.call(comd, 0, None, None, outptr, errptr)<br>
> errptr.close()<br>
> outptr.close()<br>
> if not retval == 0:<br>
>         errptr = file(errFile, "r")<br>
>         errData = errptr.read()<br>
>         errptr.close()<br>
>         raise Exception("Error executing command: " + repr(errData))<br>
><br>
><br>
> but after trying to execute this independently, I get the following error<br>
> which I am unable to interpret :<br>
><br>
> Traceback (most recent call last):<br>
>   File "process.py", line 18, in <module><br>
>     retval = subprocess.call(comd, 0, None, None, outptr, errptr)<br>
>   File "/usr/lib/python2.5/subprocess.py", line 443, in call<br>
>     return Popen(*popenargs, **kwargs).wait()<br>
>   File "/usr/lib/python2.5/subprocess.py", line 593, in __init__<br>
>     errread, errwrite)<br>
>   File "/usr/lib/python2.5/subprocess.py", line 1135, in _execute_child<br>
>     raise child_exception<br>
<br>
</div></div>There should be at least one more line in this traceback, and that<br>
line is the most important one.<br>
People will need that line to help you with your problem.<br>
<br>
Cheers,<br>
Chris<br>
<font color="#888888"><br>
--<br>
Follow the path of the Iguana...<br>
<a href="http://rebertia.com" target="_blank">http://rebertia.com</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>I just want to LIVE while I'm alive.<br><br><br>AB<br>