popen hangs until closed

Mike Müller mmueller at dgfz.de
Mon Sep 4 03:04:55 EDT 2000


>By "hangs" do you just mean that you wait to receive output that never
>arrives?

Yes. It is like an endless loop. I have to break out by closing the console.
^C or ^Z do not work.

>Under Unix, ptys provide a simulation of a normal tty and can fool
>applications into working as if they had a real interactive session
>even though it is through a pipe (this is what 'expect' uses for
>example), but there really isn't any equivalent under Windows.  I
>believe I heard in the past that the Windows expect version does
>somehow manage some of this, but I'm not sure.

Thanks for your hints. Now I now at least what to look for.

I would need some kind of pty or expect because I have the executable only.
I found three different versions of expect in Python (expy, Pyexpect and
ExpectPy) but all of them seem to be for Unix (using os.system(some pty
related commands)) or FCNTL (file control something which seems Unix
specific). If I am mistaking here and they can be used on Win32 please let
me know.
Sources:
Expectpy (builds on expy) :
http://starship.python.net/crew/arcege/ExpectPy/
PyExpect :
http://theopenlab.uml.edu/pipermail/loci-general/1999-April/000006.html

There is an TCL version of  expect for Windows NT
(http://bmrc.berkeley.edu/people/chaffee/expectnt.html) which is implemented
with the help of some C code. I just don't know enough C to get it to work
with Python. But maybe someone has done this work already and wants to share
this work?

Also the cygwin installation (B20) has something called expect (expect.com)
which when called from cygwin-bash changes the prompt to expect 1.1> and
after I hit enter to expect1.2> and so on. Is there any way to utilise this
functionality for my purposes (If it is not something totally different with
just the same name).

Or in short:
Is there something like expect for Python on Win32?

Mike







More information about the Python-list mailing list