popenX() misunderstanding on win32

Jon Nicoll jkn at nicorp.f9.co.uk
Mon May 20 13:20:23 EDT 2002


Hello there

    I'm trying to get a small python script running under WinNT and am
having trouble due to my lack of understanding of the mechanism of
popen2() etc. I know that previous versions of popenX() have been
broken but I don't think that's the problem.

In its simplest form:

Say I have a console program UPPER.EXE, which loops round echoing
standard input to standard output:

c:\> upper
qwertyuiop    # my typing
QWERTYUIOP    # the program
etaions       # me
ETAOINS       # the program
...
^C
C:\>

Then, how can I use popenX() to invoke the program, and write and read
to 'stdin' and 'stdout', to duplicate the above? my experiments so
far, involving os.popenX() and win32pipe.popenX(), haven't got me
anywhere - I either get nothing when I do a read, or the process hangs
waiting for input that I think should alread be there.

    Thanks for any pointers
    Jon N



More information about the Python-list mailing list