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 lemburg
Recipients Neil Muller, amaury.forgeotdarc, benjamin.peterson, eric.araujo, ezio.melotti, georg.brandl, gvanrossum, krawyoti, lemburg, vstinner
Date 2011-03-09.11:24:05
SpamBayes Score 0.0
Marked as misclassified No
Message-id <4D776354.6090801@egenix.com>
In-reply-to <1299153384.58.0.61614979473.issue6490@psf.upfronthosting.co.za>
Content
STINNER Victor wrote:
> 
> STINNER Victor <victor.stinner@haypocalc.com> added the comment:
> 
> r55334 removed popen2, popen3 and popen4 from the os module from Python 3 (before the 3.0 release), but not os.popen.
> 
> Python 3.2 has now convenience functions in subprocess to get the output of a program:
> 
> - check_output()
> - getstatusoutput()
> - getoutput()
> 
> They have a better API then os.popen because you can:
> 
>  - avoid the shell process and use a list of arguments (to avoid ugly shell quoting using ' or ")
>  - change the current directory
>  - decide if signal are restored or not
>  - get easily the exit code (not >> 8 magical operation on the close() output)
>  - use a different executable name
>  - pass file descriptor
>  - etc.

Right, but not all applications need all those features and
os.popen() has a nice, simple and well-known interface.

Since os.popen() is already implemented using subprocess, all
applications using os.popen() will benefit from any bug fixes
immediately, so the support effort in keeping it around is very low.

> I think that it's time to move forward and remove os.popen(). But... there are 66 calls to os.popen() in:
> 
> Doc/tools/docutils/writers/odf_odt
> Lib
> Lib/ctypes
> Lib/distutils
> Lib/distutils/command
> Lib/distutils/tests
> Lib/idlelib
> Lib/multiprocessing
> Lib/pydoc_data
> Lib/test
> Lib/tkinter/test/test_tkinter
> Mac/BuildScript
> Mac/Tools
> PCbuild
> PC/VC6
> PC/VS7.1
> PC/VS8.0
> Tools/msi
> Tools/scripts
> 
> So we can maybe start with:
>  - Restore the documentation

+1

As for the other popen() variants: those are already gone and are
indeed better implemented using subprocess directly.
History
Date User Action Args
2011-03-09 11:24:07lemburgsetrecipients: + lemburg, gvanrossum, georg.brandl, amaury.forgeotdarc, vstinner, benjamin.peterson, ezio.melotti, Neil Muller, eric.araujo, krawyoti
2011-03-09 11:24:06lemburglinkissue6490 messages
2011-03-09 11:24:05lemburgcreate