"Andre Walker-Loud" <[EMAIL PROTECTED]> wrote
> this module.class - if someone with more experience would feel
> inclined to provide an example, I would be very much appreciative.
The subprocess module documentation has several examples
of using both the Popen class and the call function.
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 - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor