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

SourceForge.net noreply at sourceforge.net
Thu Aug 12 23:28:01 CEST 2004


Bugs item #1008275, was opened at 2004-08-12 21:28
Message generated for change (Tracker Item Submitted) made by Item Submitter
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: Open
Resolution: None
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/

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

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