[Python-Dev] deprecate commands.getstatus()
Brett Cannon
brett at python.org
Fri Mar 23 00:57:15 CET 2007
On 3/22/07, Guido van Rossum <guido at python.org> wrote:
> 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*()?
>
popen2 is already slated for removal in PEP 3108 based on subprocess
making is obsolete (as is commands).
-Brett
> 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/)
> _______________________________________________
> 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/brett%40python.org
>
More information about the Python-Dev
mailing list