Pexpect is a pure Python module that reads the output of a program and sends input to that program based on output patterns. It can be used to automate interactions with interactive programs. It is inspired by the classic TCL expect program.
Pexpect is a pure Python module for controlling and automating other programs. It
Pexpect is similar to the Don Libes Expect system in TCL, but with a different interface that is intended to be easier to understand.
Pexpect is basically a pattern matching system. It runs programs and watches output. When the output matches a given pattern Pexpect can respond by sending input to the program. Pexpect can be used for automation, testing, and screen scraping of interactive programs. From the project description:
Pexpect can be used for automating interactive console applications such as ssh, ftp, passwd, telnet, etc. It can also be used to control web applications via
lynx
,w3m
, or some other text-based web browser. Pexpect is pure Python. Unlike other Expect-like modules for Python Pexpect does not require TCL or Expect nor does it require C extensions to be compiled. It should work on any platform that supports the standard Python pty module.
Resources
- Home page
- Project wiki
- Pypi (with a link to version 3.1)
- Sourceforge page