Python & Expect
claird at lairds.com
Wed Dec 10 20:39:32 CET 2003
In article <nkjetvod84erkmh6f0098lvac6hlifgaha at 4ax.com>,
Jeff Wagner <JWagner at hotmail.com> wrote:
>On Wed, 10 Dec 2003 08:57:18 -0500, Peter Hansen <peter at engcorp.com> wrotf:
>>Jeff Wagner wrote:
>>> Is there an Expect-like module for Python that is cross platform and,
>for the most part, does what
>>> Expect does? A number of years ago, I wrote some Tcl scripts using
>Expect for automation. I am
>>> trying to convince my good friend who I worked with at the time to
>try Python. He said, "what about
>>> I have heard of a Pexpect but was told that it didn't run on win32
>and he needs win32 and Linux
>>> support both.
>>Pexpect does not currently work on the standard Windows Python(see the
>>however, it seems to work fine using Cygwin. ...
>Ok, I did look at it and mentioned in my post that Pexpect doesn't run
>on win32. The question was,
>is there a Expect-like module that does run on win32. I couldn't find one.
Yes and no.
I could write a book on that one question--in fact, I've given
serious thought to the possibility. The basic answer is, no,
but there are at least a half-dozen qualifications to that.
The answer to, "What about Expect?" is this: it's a wonderful
application, with all sorts of virtues--but it is NOT effec-
tively available for Windows. So, in deciding between Python
and Tcl, if the requirement is for a current Expect-like thing,
Tcl has no particular advantage over Python, 'cause they both
depend, at least for now, on POSIXy ptys.
I think Expect and Tcl quite valuable; I use 'em all the time.
HOWEVER, along with understanding the lack of portability of
the pty abstraction to Windows, the second crucial fact you
deserve to know is that Expect is far less necessary for most
people than it used to be, or than they persist in thinking it
is now. You can automate telnet, FTP, SMTP, and much else,
without recourse to Expect.
As is so often the case, the best advice I know is to take a
little time and think over your true requirements again.
Cameron Laird <claird at phaseit.net>
More information about the Python-list