popen under nt?

David Bolen db3l at fitlinxx.com
Tue Aug 1 16:16:30 EDT 2000


Thomas Thiele <thiele at muc.das-werk.de> writes:

> I'm looking for a functinality like popen but under nt. It meands
> starting a new programm in a new "process" and read stdout and stderr.

If you'll be running in a console under NT, just go ahead and use the
standard library os.popen() function - it works fine.  

If you need to run from within a Windowing environment (Pythonwin, or
if your script is started with pythonw.exe) then that won't work, but
there are replacement functions in the win32pipe module of the win32
extensions.

Note that there is one minor difference - the extension version does
not currently return the exit code of the process.

Oh, and os.popen() or win32pipe.popen() will only give you stdout of
the process (so add something like "2>&1" if you want stderr too), but
win32pipe has additional popen2,3,4 functions that provide addition
handles to the child process if you want them separately.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list