Expect is a module used for spawning child applications and controlling them. I'm interested in Python and Ruby.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
You can use the Windows CMD prompt.
You need to have Python installed in your Windows installation.
Open a cmd prompt and execute the below command:
C:\Users\xxx>pip install pexpect
(if you have set the Python path in a system variable)or
winpexpect
is a native port ofpexpect
to Windows. It can be found here:https://github.com/geertj/winpexpect
Use pexpect https://github.com/pexpect/pexpect
"Pexpect is pure Python" so it will run anywhere, without Cygwin too,
edit: pexpect depends on pty module which is currently available only for Linux, so as Nik suggested you should be using wexpect which is a port of pexpect
The latest working version of wexpect lives at http://sage.math.washington.edu/home/goreckc/sage/wexpect/
Hopefully it will be merged upstream soon.
I've successfully used Pexpect under Cygwin. For now there is no other way due to POSIX compatibility problems under Windows.
Another thing: WExpect works like Pexpect, in fact it requires Cygwin! At this point, PExpect is a better choice.
There is WExpect for Python.
Notes in the
wexpect.py
file (typos unchanged and highlighting added)