[Python-Dev] deprecate commands.getstatus()

Guido van Rossum guido at python.org
Thu Mar 22 21:38:10 CET 2007


Sounds good to me. In 3.0 we should probably not have os.popen*(), nor
the popen2 module at all, and do everything via the subprocess module.
I wonder if we should even get rid of os.system(); then there should
be a subprocess.system() instead. And do we even need os.fork(),
os.exec*(), os.spawn*()?

On 3/22/07, Titus Brown <titus at caltech.edu> wrote:
> Hi all,
>
> I posted about adding 'get_output', 'get_status_output', and
> 'get_status_output_errors' to subprocess here,
>
>     http://ivory.idyll.org/blog/mar-07/replacing-commands-with-subprocess
>
> and got some interesting responses.
>
> Briefly, my original proposal was to add these three functions:
>
>   output = get_output(cmd, input=None, cwd=None, env=None)
>
>   (status, output) = get_status_output(cmd, input=None, cwd=None, env=None)
>   (status, output, errout) = get_status_output_errors(cmd, input=None,
>                                                       cwd=None, env=None)
>
> Commenters convinced me to propose a few additions.  In order of
> estimated plausibility,
>
>  * first, all sensical keyword args to subprocess.Popen
>    (everything but universal_newlines, stdout, stderr, and bufsize,
>    which don't make much sense in the context of the proposed functions)
>    should be accepted by the 'get_' functions.
>
>    This complicates the function signatures but does make them
>    potentially much more useful.
>
>  * second, I'd like to add a 'require_success' bool keyword, that is
>    by default False (and does nothing in that case).  However, when
>    True, the functions would emulate check_call, i.e. they would raise
>    CalledProcessError when the returncode was not zero.
>
>  * third, the 'popen2' module should be deprecated for 2.6.  I don't see
>    that it has anything in it that subprocess doesn't have.
>
> Thoughts?
>
> --titus
>
> p.s. This has been a fun learning process... ;)
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list