wexpect-venv/doc/source/index.rst

70 lines
1.9 KiB
ReStructuredText
Raw Permalink Normal View History

2020-03-10 16:03:19 +00:00
Wexpect version |version|
=========================
.. image:: https://ci.appveyor.com/api/projects/status/tbji72d5s0tagrt9?svg=true
:target: https://ci.appveyor.com/project/raczben/wexpect
:align: right
:alt: Build status
2020-03-11 14:02:22 +00:00
2020-03-10 16:03:19 +00:00
*Wexpect* is a Windows variant of `Pexpect <https://pexpect.readthedocs.io/en/stable/>`_
Wexpect and Pexpect makes Python a better tool for controlling other applications.
Wexpect is a Python module for spawning child applications;
controlling them; and responding to expected patterns in their output.
Wexpect works like Don Libes' Expect. Wexpect allows your script to
spawn a child application and control it as if a human were typing
commands.
Wexpect can be used for automating interactive applications such as
ssh, ftp, passwd, telnet, etc. It can be used to a automate setup
scripts for duplicating software package installations on different
servers. It can be used for automated software testing.
Wexpect highly depends on Mark Hammond's `pywin32 <https://github.com/mhammond/pywin32>`_
which provides access to many of the Windows APIs from Python.
Install
^^^^^^^
Wexpect is on PyPI, and can be installed with standard tools::
pip install wexpect
2020-03-11 14:02:22 +00:00
Hello Wexpect
^^^^^^^^^^^^^
2020-03-10 16:03:19 +00:00
To interract with a child process use :code:`spawn` method:
.. code-block:: python
2020-04-07 10:04:06 +00:00
import wexpect
2020-03-10 16:03:19 +00:00
child = wexpect.spawn('cmd.exe')
child.expect('>')
child.sendline('ls')
child.expect('>')
print(child.before)
child.sendline('exit')
2020-04-07 10:04:06 +00:00
For more information see `examples <https://github.com/raczben/wexpect/tree/master/examples>`_ folder.
2020-03-10 16:03:19 +00:00
Contents:
2020-04-07 10:04:06 +00:00
2020-03-10 16:03:19 +00:00
.. toctree::
:maxdepth: 2
api/index
history
2020-04-14 08:53:11 +00:00
examples
2020-03-10 16:03:19 +00:00
Wexpect is developed `on Github <http://github.com/raczben/wexpect>`_. Please
report `issues <https://github.com/raczben/wexpect/issues>`_ there as well.
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`