Sarge is one way to appropriately wrap Process Control (with shell-like piping of stdin and stdout between multiple processes).<div><br></div><div>os.system just calls C system(), AFAIU</div><div><br></div><div>subprocess.call calls subprocess.Popen, which does far more than just wrapping C system(); though the return value is also the process returncode.</div><div> </div><div><div><br></div><div><a href="https://sarge.readthedocs.io/en/latest/">https://sarge.readthedocs.io/en/latest/</a></div><div><div><br></div><div><a href="https://docs.python.org/3/library/os.html#os.system">https://docs.python.org/3/library/os.html#os.system</a><br></div><div><a href="https://github.com/python/cpython/blob/master/Modules/posixmodule.c">https://github.com/python/cpython/blob/master/Modules/posixmodule.c</a><br></div><div><br></div><div><a href="https://docs.python.org/3/library/subprocess.html#subprocess.Popen.returncode">https://docs.python.org/3/library/subprocess.html#subprocess.Popen.returncode</a><br></div><div><br></div><div><a href="https://docs.python.org/3/library/subprocess.html#subprocess.call">https://docs.python.org/3/library/subprocess.html#subprocess.call</a><br></div><div><br></div><div><a href="https://docs.python.org/3/library/subprocess.html#subprocess.check_call">https://docs.python.org/3/library/subprocess.html#subprocess.check_call</a><br></div><div><br></div><div><a href="https://en.wikipedia.org/wiki/System_call">https://en.wikipedia.org/wiki/System_call</a></div><div><a href="https://en.wikipedia.org/wiki/Exec_(system_call)">https://en.wikipedia.org/wiki/Exec_(system_call)</a></div><div><br></div><div>...</div><div><br></div><div>"ENH: Add call, check_call, check_output, CalledProcessError, expect_returncode"<br></div><div><a href="https://bitbucket.org/vinay.sajip/sarge/pull-requests/1/enh-add-call-check_call-check_output/diff">https://bitbucket.org/vinay.sajip/sarge/pull-requests/1/enh-add-call-check_call-check_output/diff</a><br></div><div><br>On Wednesday, October 24, 2018, Steve Dower <<a href="mailto:steve.dower@python.org">steve.dower@python.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 24Oct2018 0934, Calvin Spealman wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In the spirit of "There should be one-- and preferably only one --obvious way to do it." this makes perfect sense.<br>
</blockquote>
<br>
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.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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 clear.<br>
</blockquote>
<br>
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.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Simply put, there is no valid use case for os.system over subprocess by remaining it must be considered redundant.<br>
</blockquote>
<br>
You have not shown this. Posting quotes followed by an unrelated conclusion isn't a very compelling form of argument :)<br>
<br>
Cheers,<br>
Steve<br>
______________________________<wbr>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/wes.turner%40gmail.com" target="_blank">https://mail.python.org/mailma<wbr>n/options/python-dev/wes.<wbr>turner%40gmail.com</a><br>
</blockquote></div></div></div>