Author lemburg
Recipients Neil Muller, amaury.forgeotdarc, benjamin.peterson, cvrebert, eric.araujo, ezio.melotti, georg.brandl, gvanrossum, krawyoti, lemburg, vstinner
Date 2011-05-30.11:27:31
SpamBayes Score 5.88418e-15
Marked as misclassified No
Message-id <4DE37F1F.1060903@egenix.com>
In-reply-to <1306753049.42.0.911578509385.issue6490@psf.upfronthosting.co.za>
Content
Chris Rebert wrote:
> 
> Chris Rebert <pybugs@rebertia.com> added the comment:
> 
> Per msg129958, attached is my stab at a patch to replace most uses of os.popen() with the subprocess module. The test suite passes on my Mac, but the patch does touch some specific-to-other-platform code, so further testing is obviously needed.
> This is my first non-docs patch, please be gentle. :) [Those patches were to subprocess' docs though!]
> 
> Stuff still using os.popen() that the patch doesn't fix:
> - multiprocessing
> - platform.popen() [which is itself deprecated]
> - subprocess.check_output()
> - Lib/test/test_poll.py
> - Lib/test/test_select.py
> - Lib/distutils/tests/test_cygwinccompiler.py
> 
> Also, I suppose Issue 9382 should be marked as a dupe of this one?

Thanks, but I still don't understand why os.popen() wasn't removed
from the list of deprecated APIs as per Guido's message further up
on the ticket.

If you look at the amount of code you need to add in order
to support the os.popen() functionality directly using
subprocess instead of going the indirect way via the existing
os.popen() wrapper around the subprocess functionality, I think
this shows that the wrapper is indeed a good thing to have
and something you'd otherwise implement anyway as part of
standard code refactoring.

So instead of applying such a patch, I think we should add back
the documentation for os.popen() and remove the deprecation
notices.

The deprecations for os.popenN() are still fine, since those
APIs are not used all that much, and I'm sure that no one can
really remember what all the different versions do anyway :-)

os.popen() OTOH is often used and implements a very common
use: running an external command and getting the stdout
results back for further processing.
History
Date User Action Args
2011-05-30 11:27:32lemburgsetrecipients: + lemburg, gvanrossum, georg.brandl, amaury.forgeotdarc, vstinner, benjamin.peterson, ezio.melotti, Neil Muller, eric.araujo, cvrebert, krawyoti
2011-05-30 11:27:32lemburglinkissue6490 messages
2011-05-30 11:27:31lemburgcreate