STINNER Victor <victor.stin...@haypocalc.com> added the comment:

r55334 removed popen2, popen3 and popen4 from the os module from Python 3 
(before the 3.0 release), but not os.popen.

Python 3.2 has now convenience functions in subprocess to get the output of a 
program:

- check_output()
- getstatusoutput()
- getoutput()

They have a better API then os.popen because you can:

 - avoid the shell process and use a list of arguments (to avoid ugly shell 
quoting using ' or ")
 - change the current directory
 - decide if signal are restored or not
 - get easily the exit code (not >> 8 magical operation on the close() output)
 - use a different executable name
 - pass file descriptor
 - etc.

I think that it's time to move forward and remove os.popen(). But... there are 
66 calls to os.popen() in:

Doc/tools/docutils/writers/odf_odt
Lib
Lib/ctypes
Lib/distutils
Lib/distutils/command
Lib/distutils/tests
Lib/idlelib
Lib/multiprocessing
Lib/pydoc_data
Lib/test
Lib/tkinter/test/test_tkinter
Mac/BuildScript
Mac/Tools
PCbuild
PC/VC6
PC/VS7.1
PC/VS8.0
Tools/msi
Tools/scripts

So we can maybe start with:
 - Restore the documentation
 - Mark this function as deprecated in the doc
 - Emit a deprecating warning in the code
 - Start to replace os.popen() with subprocess in Python

And then maybe never drop it :-)

Note: even subprocess.getstatusoutput() is implemented using os.popen()...

----------
nosy: +haypo

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6490>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to