popen2.Popen3 on Windows
justinjohnson at fastmail.fm
Tue Jun 17 15:08:45 CEST 2003
Thank you so much. This looks like what I needed.
On Tue, 17 Jun 2003 08:39:23 +0100, "Ian McConnell"
<ian at emit.demon.co.ukx> said:
> Peter Hansen <peter at engcorp.com> writes:
> > Justin Johnson wrote:
> >> I need a way to run an external command, grab its output (stdout,stderr)
> >> and get a return status for the command. It seems like popen2.Popen3
> >> (Note the upper case "P") is the way to do this, but it only works on
> >> unix. Is there a way to get this info on Windows?
> > You might get more or better replies if you create your posting as
> > a new one, rather than replying to an existing one and changing the
> > subject. Many news and mail readers will do "threading" which means
> > your article will show up as part of the discussion to which you
> > replied, and many people will have killed that thread (and thus
> > never see your question) by now.
> Have a look at the process package on
> process.py is a (rather large) Python module to make process control
> and more consistent on Windows and Linux. The current mechanisms
> os.system, os.exec*, os.spawn*) all have limitations.
> A quick list of some reasons to use process.py:
> * You don't have to handle quoting the arguments of your command
> You can pass in a command string or an argv.
> * You can specify the current working directory (cwd) and the
> environment (env) for the started process.
> * On Windows you can spawn a process without a console window
> * You can wait for process termination or kill the running process
> without having to worry about weird platform issues. (Killing on
> Windows should first give the process a chance to shutdown cleanly.
> Killing on Linux will not work from a different thread than the
> process that created it.)
> * ProcessProxy allows you to interact in a pseudo-event-based way
> the spawned process. I.e., you can pass in file-like object for any
> stdin, stdout, or stderr to handle interaction with the process.
> "Thinks: I can't think of a thinks. End of thinks routine": Blue Bottle
> ** Aunty Spam says: Remove the trailing x from the To: field to reply **
More information about the Python-list