Grab input&output of program on Windows
Patrick L. Nolan
pln at razzle.Stanford.EDU
Tue Jan 6 06:51:08 CET 2004
Tero Pihlajakoski <tepihlaj at nopaju.spamoulu.fi> wrote:
> Patrick L. Nolan <pln at cosmic.stanford.edu> wrote:
>> I'm going nuts trying to port an application from Linux
>> to Windows. We have a python/Tkinter script which runs
>> a C++ application. It starts it with popen4 and
>> communicates through the two pipes. It reads text output
>> from stdout until a prompt appears, then sends commands
>> through stdin.
> Sorry, if this is basic, but: Did you flush() after write()? Try using
> popen2() (there was something about popen4() on win32...), if possible
> (import popen2, etc.)?
Thanks. I skimped on the details to avoid scaring off potential
readers. Yes, I did try flushing the streams. I'm using
win32pipe.popen4() on windows and popen2.popen4() on linux.
Win32pipe is supposed to be the one that works....
* Patrick L. Nolan *
* W. W. Hansen Experimental Physics Laboratory (HEPL) *
* Stanford University *
More information about the Python-list