Ret status technique popen, popen2 (NT)

Philip Thorne pbt at pipeline.com
Sat Jun 17 04:10:03 EDT 2000


Thanks, I'm on W95a for the weekend so have given it a try on that
with mixed results. The zop test script works well but I haven't
manged to get output from anything else ("dir") as the pipe appears to
close immediately. e.g.

=== start ===
Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import piper
>>> p=piper.PipedCommand("c:\\utils\where lha.exe")
>>> print p.closed()
1
>>> print p.exitstatus()
0
>>> from os import popen
>>> w=popen("c:\\utils\where lha.exe")
>>> print w
<open file 'c:\utils\where lha.exe', mode 'r' at 79aa00>
>>> e=w.readlines()
>>> print e
['C:\\UTILS\\LHA.EXE\012', 'C:\\UTILS\\TOOLS\\LHA.EXE\012']
>>> p.close()
=== end ===

I'll try again tomorrow when I'm a little more alert.
Philb


"Neil Hodgson" <neilh at scintilla.org> wrote:

>    Thanks to some comments from David Bolen, piper has been made more
>robust. I've also fiddled with the code and added some comments.
>
>http://www.scintilla.org/piper.zip
>
>    Neil
>





More information about the Python-list mailing list