Issue 1008275: os.getstatusoutput on win32 (original) (raw)

Created on 2004-08-12 21:28 by chmou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg22052 - (view) Author: Chmouel Boudjnah (chmou) Date: 2004-08-12 21:28
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/
msg22053 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2004-08-13 09:29
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
msg22054 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2004-08-13 23:36
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.
msg22055 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-08-15 13:14
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).
History
Date User Action Args
2022-04-11 14:56:06 admin set github: 40749
2004-08-12 21:28:00 chmou create