[New-bugs-announce] [issue15585] usage of os.popen in standard library

Ramchandra Apte report at bugs.python.org
Wed Aug 8 07:18:24 CEST 2012


New submission from Ramchandra Apte:

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')

----------
components: Library (Lib)
messages: 167663
nosy: ramchandra.apte
priority: normal
severity: normal
status: open
title: usage of os.popen in standard library
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15585>
_______________________________________


More information about the New-bugs-announce mailing list