Projects / Pexpect


Pexpect is a Python Expect-like module. It spawns child applications, controls them, and responds to expected patterns in their output. It can be used for automating interactive applications such as ssh, ftp, passwd, telnet, etc. It can be used to automate setup scripts for duplicating software package installations on different servers. It can be used for automated software testing. It should work on any platform that supports the standard Python pty module. Its interface was designed to be easy-to-use, so performing simple tasks is easy. It includes an ANSI/VT100 terminal screen scraping module.

Operating Systems

Recent releases

  •  07 Apr 2009 13:32

    Release Notes: Some big patches were added, which reintroduce the expect_exact() method. Apparently, a lot of people are using this method. It speeds up pattern matching if you don't need regexes. A lot of the examples were cleaned up. The script is almost useful enough to be its own project.

    •  25 Nov 2005 00:39

      Release Notes: This release adds a new run() function which wraps the spawn() class and can handle most of the tasks for which spawn() was used (it's like a super os.system() function), a new pxssh class which specializes spawn to handle SSH connections, buffering, and improved speed.

      •  08 May 2003 10:09

        Release Notes: A run() function was added, which can be used with result = instead of child = pexpect.spawn(command). The ability to operate on open file descriptors was added, making it possible to control streams such as those from serial port devices.

        •  13 Aug 2002 21:52

          Release Notes: This project was previously named Pypect.


          Project Spotlight


          A Fluent OpenStack client API for Java.


          Project Spotlight

          TurnKey TWiki Appliance

          A TWiki appliance that is easy to use and lightweight.