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@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com