Pexpect Documentation - Read the Docs
Pexpect Documentation
Release 4.8 Noah Spurrier and contributors
Sep 12, 2023
Contents
1 Installation
3
1.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 API Overview
5
2.1 Special EOF and TIMEOUT patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Find the end of line ? CR/LF conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Beware of + and * at the end of patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.5 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.6 Pexpect on Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3 API documentation
11
3.1 Core pexpect components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2 fdpexpect - use pexpect with a file descriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.3 socket_pexpect - use pexpect with a socket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.4 popen_spawn - use pexpect with a piped subprocess . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.5 replwrap - Control read-eval-print-loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.6 pxssh - control an SSH session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4 Examples
33
5 FAQ
35
6 Common problems
39
6.1 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.2 Timing issue with send() and sendline() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.3 Truncated output just before child exits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
6.4 Controlling SSH on Solaris . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
6.5 child does not receive full input, emits BEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
7 History
41
7.1 Releases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
7.2 Moves and forks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
8 Indices and tables
49
Python Module Index
51
i
Index
53
ii
Pexpect Documentation, Release 4.8
Pexpect makes Python a better tool for controlling other applications. Pexpect is a pure Python module for spawning child applications; controlling them; and responding to expected patterns in their output. Pexpect works like Don Libes' Expect. Pexpect allows your script to spawn a child application and control it as if a human were typing commands. Pexpect 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. Pexpect is in the spirit of Don Libes' Expect, but 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. The Pexpect interface was designed to be easy to use. Contents:
Contents
1
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- pexpect documentation read the docs
- data files in python
- exploring data using python 3 charles r severance
- creating geometries and handling projections with ogr
- reading and writing data files with python
- read map and extract modis aerosol data using python
- basic python programming for loops and reading files
- computer science
- c h a p r 2 file handling in python
Related searches
- read the book thief
- how to read the stock market
- how to read the stock market chart
- how to read the s p
- how to read the dow
- how to read the spread
- read the economist online free
- how to read the runes
- read the bible online for free
- why should christians read the old testament
- how to read the nfl betting line
- what order should you read the bible