This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.system should be deprecated in favour of subprocess module
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: Jakob.Bowyer, eric.araujo, r.david.murray, rhettinger, skip.montanaro
Priority: normal Keywords:

Created on 2011-01-25 10:41 by Jakob.Bowyer, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (7)
msg126995 - (view) Author: Jakob Bowyer (Jakob.Bowyer) Date: 2011-01-25 10:41
os.system is broken in several fundamental ways. We already have the subprocess module for accessing other processes, lets send os.system the same way as os.Popen.
msg127033 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2011-01-25 18:27
I disagree.  Both os.popen and os.system work fine in the proper context
and are easier to use (and remember how to use) than the subprocess
module.  You don't give any examples of breakage, or whether said
breakage is platform-dependent.
msg127039 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-01-25 18:52
I'm inclined to reject this out-of-hand.  The os.system() call is a basic call that had been around for very long time, has been widely used successfully, and has parallels in other languages.

Please elaborate on "is broken i several fundamental ways."
msg127152 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-01-26 22:46
Note that os.popen is implemented with subprocess.  For os.system, what Raymond said: It complies with the Python habit of exposing calls as is, and its documentation already advertises subprocess.
msg127164 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2011-01-27 00:09
Eric> Note that os.popen is implemented with subprocess.

That seems somewhat wrong to me.  There is a stdio popen function which
os.popen used to expose.  I thought that was the goal (thin wrapper around
many library functions, then build higher level stuff on that).

Skip
msg127170 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-01-27 03:05
I wasn't around when that decision was made, but looking at the posixmodule.c source, system is a straightforward wrapper, but popen gets...byzantine on anything but unix.
msg128044 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-02-06 06:25
Sorry, I'm rejecting this.  No reasons were presented that would warrant such as disruptive change.

For good or ill, a number of languages implement the same call in much the same way.  It does its job of exposing an operating system service that many people have found to be useful.
History
Date User Action Args
2022-04-11 14:57:11adminsetgithub: 55212
2011-02-06 06:25:29rhettingersetstatus: open -> closed

messages: + msg128044
resolution: rejected
nosy: skip.montanaro, rhettinger, eric.araujo, r.david.murray, Jakob.Bowyer
2011-01-27 03:05:39r.david.murraysetnosy: + r.david.murray
messages: + msg127170
2011-01-27 00:09:19skip.montanarosetnosy: skip.montanaro, rhettinger, eric.araujo, Jakob.Bowyer
messages: + msg127164
2011-01-26 22:46:57eric.araujosetnosy: + eric.araujo
messages: + msg127152
2011-01-25 18:52:18rhettingersetversions: - Python 2.6, Python 3.1, Python 2.7, Python 3.2
nosy: + rhettinger

messages: + msg127039

assignee: rhettinger
2011-01-25 18:27:16skip.montanarosetnosy: + skip.montanaro
messages: + msg127033
2011-01-25 10:41:56Jakob.Bowyercreate