"Emad Nawfal (عماد نوفل)" <emadnaw...@gmail.com> wrote

proc = subprocess.Popen('python3.0 hello.py',
                      shell=True,
                      stdout=subprocess.PIPE,
                      )
stdout_value = proc.communicate()[0]

Thank you Kent.
It works, but isn't the commands module much simpler? I don't know why it's
no more available in Python3.0

commands was one of many different ways to access command ouitput.
Subprocess was designed to replace all of them and provide a single
consistent mechanism.

So, yes we lost some simplicity but gained consistency.
You no longer need to figure out whether its best to use
os,system, os.popen(and which version of popen), os.spawn, commands etc

You just use subprocess...
HTH,
Alan G

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to