1
Core pexpect components
2
=======================
4
.. automodule:: pexpect
11
.. automethod:: __init__
12
.. automethod:: expect
13
.. automethod:: expect_exact
14
.. automethod:: expect_list
15
.. automethod:: compile_pattern_list
17
.. automethod:: sendline
19
.. automethod:: writelines
20
.. automethod:: sendcontrol
21
.. automethod:: sendeof
22
.. automethod:: sendintr
24
.. automethod:: readline
25
.. automethod:: read_nonblocking
27
.. automethod:: interact
29
.. attribute:: logfile
33
Set these to a Python file object (or :data:`sys.stdout`) to log all
34
communication, data read from the child process, or data sent to the child
39
With a :class:`spawn` instance, the log files should be open for
40
writing binary data. With a :class:`spawnu` instance, they should
41
be open for writing unicode text.
43
Controlling the child process
44
`````````````````````````````
49
.. automethod:: terminate
50
.. automethod:: isalive
53
.. automethod:: getwinsize
54
.. automethod:: setwinsize
55
.. automethod:: getecho
56
.. automethod:: setecho
57
.. automethod:: waitnoecho
61
The process ID of the child process.
63
.. attribute:: child_fd
65
The file descriptor used to communicate with the child process.
72
For backwards compatibility, :class:`spawn` can handle some Unicode: its
73
send methods will encode arbitrary unicode as UTF-8 before sending it to the
74
child process, and its expect methods can accept ascii-only unicode strings.
75
However, for a proper unicode API to a subprocess, use this subclass:
80
There is also a :func:`runu` function, the unicode counterpart to :func:`run`.
84
Unicode handling with pexpect works the same way on Python 2 and 3, despite
85
the difference in names. I.e.:
87
- :class:`spawn` works with ``str`` on Python 2, and :class:`bytes` on Python 3,
88
- :class:`spawnu` works with ``unicode`` on Python 2, and :class:`str` on Python 3.
95
.. autofunction:: runu
102
.. autoclass:: TIMEOUT
104
.. autoclass:: ExceptionPexpect
109
.. autofunction:: which
111
.. autofunction:: split_command_line