[Python-Dev] "Deprecation" of os.system in favor of subprocess?
wes.turner at gmail.com
Wed Oct 24 11:30:01 EDT 2018
Sarge is one way to appropriately wrap Process Control (with shell-like
piping of stdin and stdout between multiple processes).
os.system just calls C system(), AFAIU
subprocess.call calls subprocess.Popen, which does far more than just
wrapping C system(); though the return value is also the process returncode.
"ENH: Add call, check_call, check_output, CalledProcessError,
On Wednesday, October 24, 2018, Steve Dower <steve.dower at python.org> wrote:
> On 24Oct2018 0934, Calvin Spealman wrote:
>> In the spirit of "There should be one-- and preferably only one --obvious
>> way to do it." this makes perfect sense.
> To do what? There is one obvious way to run a system command, and one
> obvious way to manage subprocesses. There are also many non-obvious ways to
> run system commands, and many non-obvious ways to manage subprocesses.
> The distinction between "your own machine and other peoples machines" is
>> not always clear, nor planned for, nor understood by developers to be an
>> important distinction to make up-front. So the encouragement should be
> Agreed. One good heuristic is whether you're putting the system command in
> a function or not, since functions are explicitly designing for reuse while
> just using it in a script is not.
> Simply put, there is no valid use case for os.system over subprocess by
>> remaining it must be considered redundant.
> You have not shown this. Posting quotes followed by an unrelated
> conclusion isn't a very compelling form of argument :)
> Python-Dev mailing list
> Python-Dev at python.org
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/wes.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev