os.popen() vs os.system()

Gerrit Holl gerrit.holl at pobox.com
Wed Dec 22 06:06:12 EST 1999


Sposhua wrote:
> a) popen automatically starts a new process while system only does it if you
> include an &

Not true:
>>> os.getpid()
3264
>>> os.system("echo $$")
3658

> b) popen hooks onto stdout and stdin

True. With os.popen(), you can read and write like a pipe.
os.system() doesn't let you do this. It's just like the C system()
function, which use I also don't understand. Maybe it's just
easier?

regards,
Gerrit.

-- 
"Nature abhors a Vacuum"

  -- Brian Behlendorf on OSS (Open Sources, 1999 O'Reilly and Associates)
 12:00pm  up 55 min, 16 users,  load average: 0.00, 0.00, 0.00




More information about the Python-list mailing list