[Twisted-Python] Python and Win32 command execution

Bram Moolenaar Bram at moolenaar.net
Tue Dec 31 11:47:18 EST 2002


I noticed your message with an example of using CreateProcess():


I actually only need a version of the os.system() command that does
return the exit value.  The problem is that under Windows 95 and 98 the
return value if always zero, thus I don't know if the command actually
worked.  For my work on A-A-P (http://www.a-a-p.org) I do need to get
the exit value.

The key to solving the problem apparently is to avoid using command.com.

It seems your example can be changed to redirect the stdout and stderr
of the command, invoke CreateProcess() and obtain the exit value.  But
it's not that simple.

Do you perhaps know a better solution?

- Bram

hundred-and-one symptoms of being an internet addict:
244. You use more than 20 passwords.

 ///  Bram Moolenaar -- Bram at moolenaar.net -- http://www.moolenaar.net  \\\
///          Creator of Vim - Vi IMproved -- http://www.vim.org          \\\
\\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
 \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///

More information about the Twisted-Python mailing list