classification
Title: get status output fix for Win32
Type: Stage: test needed
Components: Library (Lib), Windows Versions: Python 2.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, christian.heimes, dandel1984, jorend (4)
Priority: normal Keywords patch

Created on 2007-04-25 23:13 by dandel1984, last changed 2009-05-25 17:11 by amaury.forgeotdarc.

Files
File name Uploaded Description Edit Remove
win32_commands.diff dandel1984, 2007-04-25 23:13 Fix for commands.py
Messages (5)
msg52526 - (view) Author: Ken Phillis Jr. (dandel1984) Date: 2007-04-25 23:13
the two command output retrieval functions for python are broken on win32, and this patch fixes this, although it is possible that this fix will also work on dos, and os/2, but i am not sure about this... I've already tested it against python 2.5, 2.4 and 2.3, on windows xp and server 2k3.
msg52527 - (view) Author: Jason Orendorff (jorend) Date: 2007-04-26 14:27
Ken, thanks for the patch!  To be considered for Python 2.6, this patch would have to update documentation (Doc/lib) and tests (Lib/test) as well.

But more importantly:  This entire module is likely to be deprecated in Python 2.6, in favor of the subprocess module (which will gain new functions, subprocess.get_output() and subprocess.get_status_output().)  There was a long discussion about it on python-dev:

(start of a long thread)
http://mail.python.org/pipermail/python-dev/2007-March/071929.html

(even more)
http://mail.python.org/pipermail/python-dev/2007-March/072046.html

If that happens, there's no particular reason to do this, right?
msg52528 - (view) Author: Ken Phillis Jr. (dandel1984) Date: 2007-04-27 01:14
there is still a reason to do this, except for it'll haft to be integrated into the new module, because of how windows/dos handle the command line input, and most people will try working it as is, which is just simply put in a windows/dos command and expect it to work like it does in unix based systems, at which this does the job really well... a sample of that would be to call it like so:

commands.get_output("echo Testing")

as for tests I'll get that generated fast, so expect something to be posted in a few days.
msg59363 - (view) Author: Christian Heimes (christian.heimes) Date: 2008-01-06 12:44
Do you call 8 months "a few days"? *g*
msg88320 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) Date: 2009-05-25 17:11
The 'commands' module is deprecated, and has been removed in Python 3.0:
http://docs.python.org/dev/library/commands.html

The recommended (and portable) method is to use subprocess:
    p = subprocess.Popen(command, stdout=PIPE, stderr=STDOUT, shell=True)
    output = p.communicate()[0]

I suggest closing this issue.
History
Date User Action Args
2009-05-25 17:11:51amaury.forgeotdarcsetnosy: + amaury.forgeotdarc

messages: + msg88320
versions: - Python 3.1
2009-04-27 23:51:36ajaksu2setstage: test needed
versions: + Python 3.1
2008-01-06 12:44:34christian.heimessetnosy: + christian.heimes
messages: + msg59363
components: + Windows
versions: + Python 2.6
2007-04-25 23:13:38dandel1984create