mirror of
https://github.com/clearml/wexpect-venv
synced 2025-02-07 05:20:52 +00:00
[CLN] README
This commit is contained in:
parent
2bd27dc77e
commit
f8333b7d2b
81
README.md
81
README.md
@ -1,53 +1,53 @@
|
|||||||
# wexpect
|
# **wexpect**
|
||||||
|
|
||||||
wexpect is a Windows alternative of [pexpect](https://pexpect.readthedocs.io/en/stable/).
|
*Wexpect* is a Windows variant of [pexpect](https://pexpect.readthedocs.io/en/stable/).
|
||||||
|
|
||||||
|
*Pexpect* is a Python module for spawning child applications and controlling
|
||||||
|
them automatically.
|
||||||
|
|
||||||
|
## **Install**
|
||||||
|
|
||||||
|
pip install wexpect
|
||||||
|
|
||||||
|
Note that only python 2.x is supported.
|
||||||
|
|
||||||
|
## **Usage**
|
||||||
|
|
||||||
|
To interract with a child process use `spawn` method:
|
||||||
|
|
||||||
|
child = pexpect.spawn('C:\Windows\System32\cmd.exe')
|
||||||
|
child.expect('>')
|
||||||
|
child.sendline('ls')
|
||||||
|
child.expect('>')
|
||||||
|
|
||||||
|
For more information see [examples](./examples) folder.
|
||||||
|
|
||||||
---
|
---
|
||||||
## pexpect
|
## What is it?
|
||||||
|
|
||||||
Pexpect is a Python module for spawning child applications and controlling
|
Wexpect is a Python module for spawning child applications and controlling
|
||||||
them automatically. Pexpect can be used for automating interactive applications
|
them automatically. Wexpect can be used for automating interactive applications
|
||||||
such as ssh, ftp, passwd, telnet, etc. It can be used to a automate setup
|
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
|
scripts for duplicating software package installations on different servers. It
|
||||||
can be used for automated software testing. Pexpect is in the spirit of Don
|
can be used for automated software testing. Wexpect is in the spirit of Don
|
||||||
Libes' Expect, but Pexpect is pure Python. Other Expect-like modules for Python
|
Libes' Expect, but Wexpect is pure Python. Other Expect-like modules for Python
|
||||||
require TCL and Expect or require C extensions to be compiled. Pexpect does not
|
require TCL and Expect or require C extensions to be compiled. Wexpect does not
|
||||||
use C, Expect, or TCL extensions. It should work on any platform that supports
|
use C, Expect, or TCL extensions.
|
||||||
the standard Python pty module. The Pexpect interface focuses on ease of use so
|
|
||||||
that simple tasks are easy.
|
|
||||||
|
|
||||||
There are two main interfaces to Pexpect -- the function, run() and the class,
|
Original Pexpect should work on any platform that supports the standard Python pty module. While
|
||||||
spawn. You can call the run() function to execute a command and return the
|
Wexpect works on Windows platforms. The Wexpect interface focuses on ease of use so that simple
|
||||||
output. This is a handy replacement for os.system().
|
tasks are easy.
|
||||||
|
|
||||||
For example::
|
|
||||||
|
|
||||||
pexpect.run('ls -la')
|
### History
|
||||||
|
|
||||||
The more powerful interface is the spawn class. You can use this to spawn an
|
Wexpect is a one-file code developed at University of Washington. There are several
|
||||||
external child command and then interact with the child by sending lines and
|
[copy](https://gist.github.com/anthonyeden/8488763) and
|
||||||
expecting responses.
|
[reference](https://mediarealm.com.au/articles/python-pexpect-windows-wexpect/)
|
||||||
|
to this code with very few (almost none) documentation nor integration.
|
||||||
|
|
||||||
For example::
|
This repo tries to fix these limitations, with a few example code and pypi integration.
|
||||||
|
|
||||||
child = pexpect.spawn('scp foo myname@host.example.com:.')
|
|
||||||
child.expect ('Password:')
|
|
||||||
child.sendline (mypassword)
|
|
||||||
|
|
||||||
This works even for commands that ask for passwords or other input outside of
|
|
||||||
the normal stdio streams.
|
|
||||||
|
|
||||||
---
|
|
||||||
## Wexpect
|
|
||||||
|
|
||||||
Wexpect is a one-file code developed at University of Washington. There are several copy of this code,
|
|
||||||
with very few (almost none) documentation integration.
|
|
||||||
|
|
||||||
Here are some useful links:
|
|
||||||
- https://gist.github.com/anthonyeden/8488763
|
|
||||||
- https://mediarealm.com.au/articles/python-pexpect-windows-wexpect/
|
|
||||||
|
|
||||||
This repo tries to fix these limitations.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
## Installation and limitation of wexpect
|
## Installation and limitation of wexpect
|
||||||
@ -69,8 +69,3 @@ One (non stanbdard) package, **pypiwin32** is needed by wexpect.
|
|||||||
|
|
||||||
pip install pypiwin32
|
pip install pypiwin32
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
See pexpect examples for usage.
|
|
||||||
|
Loading…
Reference in New Issue
Block a user