The black art of popen on windows

Paul Nilsson python.newsgroup at REMOVE.paulnilsson.com
Sat Feb 15 17:48:10 EST 2003


Hello, I'm having problems writing a python program which interfaces
with a windows commandline program via popen4().

The problem is the input pipe can produce data at any time, and the
output pipe may wish to send data at any time. Using readline() on the
input causes the file to block, causing the program to halt (even if
its threaded) causing a deadlock.

In unix I could use a select over the files, and set them to non
blocking with FCNTL.O_NDELAY or FCNTL.FNDELAY. This technique is not
available on windows.

I have looked at the http://pexpect.sourceforge.net project but it
seems to be unuitable since it doesn't work with the standard windows
Python installation. It can run under windows but it requires cygwin
which I have, but prefer not to use for this task.

Anybody have any ideas?

Cheers, Paul




More information about the Python-list mailing list