classification
Title: usage of os.popen in standard library
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: duplicate
Dependencies: Superseder: os.popen documentation is probably wrong
View: 6490
Assigned To: Nosy List: Ramchandra Apte, r.david.murray
Priority: normal Keywords:

Created on 2012-08-08 05:18 by Ramchandra Apte, last changed 2012-08-08 17:31 by r.david.murray. This issue is now closed.

Messages (3)
msg167663 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2012-08-08 05:18
The following standard library modules use os.popen which is deprecated.
These calls should be replaced with calls to subprocess.Popen .
Ironically, even the subprocess module uses os.popen!
webbrowser.py:            osapipe = os.popen("osascript", "w")
webbrowser.py:            osapipe = os.popen("osascript", "w")
pydoc.py:    pipe = os.popen(cmd, 'w')
uuid.py:            with os.popen(cmd) as pipe:
uuid.py:            pipe = os.popen(os.path.join(dir, 'ipconfig') + ' /all')
platform.py:#            to cover up situations where platforms don't have os.popen
platform.py:        This is mostly needed in case os.popen() is not available, or
platform.py:    # over os.popen over _popen
platform.py:            popen = os.popen
platform.py:        f = os.popen('uname %s 2> %s' % (option, DEV_NULL))
platform.py:        f = os.popen('file -b "%s" 2> %s' % (target, DEV_NULL))
idlelib/IOBinding.py:            pipe = os.popen(command, "r")
os.py:# Supply os.popen()
subprocess.py:    Execute the string 'cmd' in a shell with os.popen() and return a 2-tuple
subprocess.py:    Execute the string 'cmd' in a shell with os.popen() and return a 2-tuple
subprocess.py:    pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
multiprocessing/__init__.py:            with os.popen(comm) as p:
pipes.py:for the built-in function open() or for os.popen().
pipes.py:        return os.popen(cmd, 'r')
pipes.py:        return os.popen(cmd, 'w')
ctypes/util.py:            f = os.popen(cmd)
ctypes/util.py:            with contextlib.closing(os.popen(cmd)) as f:
ctypes/util.py:            f = os.popen(cmd)
ctypes/util.py:            with contextlib.closing(os.popen(cmd)) as f:
ctypes/util.py:            with contextlib.closing(os.popen('/sbin/ldconfig -r 2>/dev/null')) as f:
ctypes/util.py:            with contextlib.closing(os.popen('LC_ALL=C LANG=C /sbin/ldconfig -p 2>/dev/null')) as f:
distutils/command/bdist_rpm.py:        out = os.popen(q_cmd)
distutils/emxccompiler.py:        out = os.popen(gcc_exe + ' -dumpversion','r')
msg167664 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2012-08-08 05:19
Sorry, os.py:# Supply os.popen() should not be in the list.
msg167699 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-08-08 17:31
There is already an open issue for this, with a (partial?) patch.
History
Date User Action Args
2012-08-08 17:31:44r.david.murraysetstatus: open -> closed

superseder: os.popen documentation is probably wrong

nosy: + r.david.murray
messages: + msg167699
resolution: duplicate
stage: resolved
2012-08-08 05:19:20Ramchandra Aptesetmessages: + msg167664
2012-08-08 05:18:24Ramchandra Aptecreate