[ python-Bugs-1008275 ] os.getstatusoutput on win32

SourceForge.net noreply at sourceforge.net
Sun Aug 15 15:14:43 CEST 2004


Bugs item #1008275, was opened at 2004-08-12 23:28
Message generated for change (Comment added) made by jlgijsbers
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1008275&group_id=5470

Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Chmouel Boudjnah (chmou)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.getstatusoutput on win32

Initial Comment:
Using:

Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200
32 bit (Intel)] on win32

i cannot run command.getstatusoutput since i guess it
expect a unix shell.

>>> import commands
>>> commands.getstatusoutput("c://usr//bin//echo")
(1, "'{' n'est pas reconnu en tant que commande
interne\nou externe, un programm
e ex\x82cutable ou un fichier de commandes.")

i had to bypass it on win32 by using this in my program :

def _getstatusoutput(cmd):
    """Return Win32 (status, output) of executing cmd
in a shell."""
    pipe = os.popen(cmd, 'r')
    text = pipe.read()
    sts = pipe.close()
    if sts is None: sts = 0
    if text[-1:] == '\n': text = text[:-1]
    return sts, text

Cheers, Chmouel. http://www.chmouel.com/wp/

----------------------------------------------------------------------

>Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-08-15 15:14

Message:
Logged In: YES 
user_id=469548

Closing. Nick: I borrowed your text for the various other
bugs/patches that ask for this (713428, 889949, 660505).

----------------------------------------------------------------------

Comment By: Nick Coghlan (ncoghlan)
Date: 2004-08-14 01:36

Message:
Logged In: YES 
user_id=1038590

The commands module is going to stay Unix-specific. There
are too many potential issues with trying to support the
various win32 command interpreters.

It will eventually be deprecated in favour of a higher level
process management API. Hopefully that will happen in the
2.5 timeframe, but we'll have to wait and see.

----------------------------------------------------------------------

Comment By: Nick Coghlan (ncoghlan)
Date: 2004-08-13 11:29

Message:
Logged In: YES 
user_id=1038590

Well, the docs for the commands module explicitly state that
it is only supported on Unix.

While two of the functions it provides (getstatusoutput()
and getoutput()) are trivial to provide on Windows, the 3rd
(getstatus()) has no equivalent that I can see.

I think I'll take this one to py-dev for further consideration


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1008275&group_id=5470


More information about the Python-bugs-list mailing list