Not sure what happened to the formatting here... It should be:
---------------------
"Alan Gauld" <[EMAIL PROTECTED]> wrote
The given example for os.system is:
sts = os.system("mycmd" + " myarg")
==>
p = Popen("mycmd" + " myarg", shell=True)
sts = os.waitpid(p.pid, 0)
To which you would need to add cwd=path making it:
p = Popen("mycmd" + " myarg", shell=True, cwd=path)
sts = os.waitpid(p.pid, 0)
The other difference using Popen is that it raises an
OSError exception if the program fails to run so you
should wrap the calls in a try/except if you want to
catch that.
------------------------
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
--------------------------------------------------------------------------------
> _______________________________________________
> Tutor maillist - [email protected]
> http://mail.python.org/mailman/listinfo/tutor
>
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor