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/
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
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.