10
The new major version number doesn't indicate any deliberate API incompatibility.
11
We have endeavoured to avoid breaking existing APIs. However, pexpect is under
12
new maintenance after a long dormancy, so some caution is warranted.
14
* A new :ref:`unicode API <unicode>` was introduced.
15
* Python 3 is now supported, using a single codebase.
16
* Pexpect now requires at least Python 2.6 or 3.2.
17
* The modules other than pexpect, such as :mod:`pexpect.fdpexpect` and
18
:mod:`pexpect.pxssh`, were moved into the pexpect package. For now, wrapper
19
modules are installed to the old locations for backwards compatibility (e.g.
20
``import pxssh`` will still work), but these will be removed at some point in
22
* Ignoring ``SIGHUP`` is now optional - thanks to Kimmo Parviainen-Jalanko for
25
We also now have `docs on ReadTheDocs <http://pexpect.readthedocs.org/>`_,
26
and `continuous integration on Travis CI <https://travis-ci.org/pexpect/pexpect>`_.
31
* Fix a bug regarding making the pty the controlling terminal when the process
32
spawning it is not, actually, a terminal (such as from cron)
37
* Fixed OSError exception when a pexpect object is cleaned up. Previously, you
38
might have seen this exception::
39
Exception exceptions.OSError: (10, 'No child processes')
40
in <bound method spawn.__del__ of <pexpect.spawn instance at 0xd248c>> ignored
41
You should not see that anymore. Thanks to Michael Surette.
42
* Added support for buffering reads. This greatly improves speed when trying to
43
match long output from a child process. When you create an instance of the spawn
44
object you can then set a buffer size. For now you MUST do the following to turn
45
on buffering -- it may be on by default in future version::
46
child = pexpect.spawn ('my_command')
47
child.maxread=1000 # Sets buffer to 1000 characters.
48
* I made a subtle change to the way TIMEOUT and EOF exceptions behave.
49
Previously you could either expect these states in which case pexpect
50
will not raise an exception, or you could just let pexpect raise an
51
exception when these states were encountered. If you expected the
52
states then the ``before`` property was set to everything before the
53
state was encountered, but if you let pexpect raise the exception then
54
``before`` was not set. Now, the ``before`` property will get set either
55
way you choose to handle these states.
56
* The spawn object now provides iterators for a *file-like interface*.
57
This makes Pexpect a more complete file-like object. You can now write
59
child = pexpect.spawn ('ls -l')
62
* write and writelines() no longer return a value. Use send() if you need that
63
functionality. I did this to make the Spawn object more closely match a
65
* Added the attribute ``exitstatus``. This will give the exit code returned
66
by the child process. This will be set to ``None`` while the child is still
67
alive. When ``isalive()`` returns 0 then ``exitstatus`` will be set.
68
* Made a few more tweaks to ``isalive()`` so that it will operate more
69
consistently on different platforms. Solaris is the most difficult to support.
70
* You can now put ``TIMEOUT`` in a list of expected patterns. This is just like
71
putting ``EOF`` in the pattern list. Expecting for a ``TIMEOUT`` may not be
72
used as often as ``EOF``, but this makes Pexpect more consitent.
73
* Thanks to a suggestion and sample code from Chad J. Schroeder I added the ability
74
for Pexpect to operate on a file descriptor that is already open. This means that
75
Pexpect can be used to control streams such as those from serial port devices. Now,
76
you just pass the integer file descriptor as the "command" when contsructing a
77
spawn open. For example on a Linux box with a modem on ttyS1::
78
fd = os.open("/dev/ttyS1", os.O_RDWR|os.O_NONBLOCK|os.O_NOCTTY)
79
m = pexpect.spawn(fd) # Note integer fd is used instead of usual string.
80
m.send("+++") # Escape sequence
81
m.send("ATZ0\r") # Reset modem to profile 0
82
rval = m.expect(["OK", "ERROR"])
83
* ``read()`` was renamed to ``read_nonblocking()``. Added new ``read()`` method
84
that matches file-like object interface. In general, you should not notice
85
the difference except that ``read()`` no longer allows you to directly set the
86
timeout value. I hope this will not effect any existing code. Switching to
87
``read_nonblocking()`` should fix existing code.
88
* Changed the name of ``set_echo()`` to ``setecho()``.
89
* Changed the name of ``send_eof()`` to ``sendeof()``.
90
* Modified ``kill()`` so that it checks to make sure the pid ``isalive()``.
91
* modified ``spawn()`` (really called from ``__spawn()``) so that it does not
92
raise an expection if ``setwinsize()`` fails. Some platforms such as Cygwin
93
do not like setwinsize. This was a constant problem and since it is not a
94
critical feature I decided to just silence the error. Normally I don't like
95
to do that, but in this case I'm making an exception.
96
* Added a method ``close()`` that does what you think. It closes the file
97
descriptor of the child application. It makes no attempt to actually kill the
98
child or wait for its status.
99
* Add variables ``__version__`` and ``__revision__`` (from cvs) to the pexpect
100
modules. This is mainly helpful to me so that I can make sure that I'm testing
101
with the right version instead of one already installed.
102
* ``log_open()`` and ``log_close(`` have been removed. Now use ``setlog()``.
103
The ``setlog()`` method takes a file object. This is far more flexible than
104
the previous log method. Each time data is written to the file object it will
105
be flushed. To turn logging off simply call ``setlog()`` with None.
106
* renamed the ``isAlive()`` method to ``isalive()`` to match the more typical
107
naming style in Python. Also the technique used to detect child process
108
status has been drastically modified. Previously I did some funky stuff
109
with signals which caused indigestion in other Python modules on some
110
platforms. It was a big headache. It still is, but I think it works
112
* attribute ``matched`` renamed to ``after``
113
* new attribute ``match``
114
* The ``expect_eof()`` method is gone. You can now simply use the
115
``expect()`` method to look for EOF.
116
* **Pexpect works on OS X**, but the nature of the quirks cause many of the
117
tests to fail. See bugs. (Incomplete Child Output). The problem is more
118
than minor, but Pexpect is still more than useful for most tasks.
119
* **Solaris**: For some reason, the *second* time a pty file descriptor is created and
120
deleted it never gets returned for use. It does not effect the first time
121
or the third time or any time after that. It's only the second time. This
122
is weird... This could be a file descriptor leak, or it could be some
123
peculiarity of how Solaris recycles them. I thought it was a UNIX requirement
124
for the OS to give you the lowest available filedescriptor number. In any case,
125
this should not be a problem unless you create hundreds of pexpect instances...
126
It may also be a pty module bug.
132
* Pexpect development used to be hosted on Sourceforge.
133
* In 2011, Thomas Kluyver forked pexpect as 'pexpect-u', to support
134
Python 3. He later decided he had taken the wrong approach with this.
135
* In 2012, Noah Spurrier, the original author of Pexpect, moved the
136
project to Github, but was still too busy to develop it much.
137
* In 2013, Thomas Kluyver and Jeff Quast forked Pexpect again, intending
138
to call the new fork Pexpected. Noah Spurrier agreed to let them use
139
the name Pexpect, so Pexpect versions 3 and above are based on this
140
fork, which now lives `here on Github <https://github.com/pexpect/pexpect>`_.