This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients lemburg, vstinner
Date 2011-03-02.22:19:58
SpamBayes Score 8.105546e-09
Marked as misclassified No
Message-id <1299104399.44.0.716120202762.issue11377@psf.upfronthosting.co.za>
In-reply-to
Content
os.popen() is deprecated since Python 2.6 ("Use the subprocess module.") and it is no more documented in Python 3. The following documentation explains how to replace os.popen() by subprocess:

http://docs.python.org/py3k/library/subprocess.html#replacing-os-popen-os-popen2-os-popen3

> Does it prevent a shell window from opening on Windows ?

Yes, but only if shell=True.

> Does subprocess.Popen() use the system's PATH for finding the
executable ?

Yes. The subprocess module calls os.get_exec_path() which reads PATH environment variable.

> Since it's a documented API, we could replace it with an
> implementation that uses subprocess.Popen(),

platform_popen.patch patchs platform.popen() to reuse os.popen() (which uses subprocess). It adds also tests (there was no test for platform.popen)

> but not remove it.

Can't we at deprecate platform.popen in favor of subprocess, with a documentation to explain how to port code to subprocess?

My patch doesn't touch platform documentation.

--

os.popen() does still exist in Python 3.2, but it is no more documented. Its documentation should be fixed or the function should be removed.
History
Date User Action Args
2011-03-02 22:19:59vstinnersetrecipients: + vstinner, lemburg
2011-03-02 22:19:59vstinnersetmessageid: <1299104399.44.0.716120202762.issue11377@psf.upfronthosting.co.za>
2011-03-02 22:19:58vstinnerlinkissue11377 messages
2011-03-02 22:19:58vstinnercreate