os.popen--which one to use?

kyosohma at gmail.com kyosohma at gmail.com
Tue Apr 3 21:03:06 CEST 2007

On Apr 3, 1:53 pm, Kevin Walzer <k... at codebykevin.com> wrote:
> I'm confused by the number of variations on "popen" that Python offers.
> I'm using os.popen in my programs without difficulty. Is this wrong?
> Should I be using popen 2, popen3, etc.? I'm not clear on what the
> advantages of popen2, 3 etc. are: they seem a lot more complicated.
> --
> Kevin Walzer
> Code by Kevinhttp://www.codebykevin.com

There's nothing wrong with using os.popen. Some of them are Unix
specific though. And that module's functionality along with os.system,
os.spawn and commands have all be integrated into the subprocess
module, which I think is much less confusing. The only places I've
seen a fairly coherent run-down of the os.popen modules is the "Python
in a Nutshell" book and maybe (I can't remember for sure) "Core Python

See http://pydoc.org/2.4.1/subprocess.html for more info on the
subprocess module.


More information about the Python-list mailing list