Skip to main content

wexpect

wexpect is a Windows alternative of pexpect.

pexpect

Pexpect is a Python module for spawning child applications and controlling them automatically. Pexpect 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. Pexpect is in the spirit of Don Libes' Expect, but Pexpect is pure Python. Other Expect-like modules for Python require TCL and Expect or require C extensions to be compiled. Pexpect does not use C, Expect, or TCL extensions. It should work on any platform that supports 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, spawn. You can call the run() function to execute a command and return the output. This is a handy replacement for os.system().

For example::

pexpect.run('ls -la')

The more powerful interface is the spawn class. You can use this to spawn an external child command and then interact with the child by sending lines and expecting responses.

For example::

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:

This repo tries to fix these limitations.

Installation and limitation of wexpect

Current version does not work on python-3.x. You need to use python 2.x to use wexpect.

One (non stanbdard) package, pypiwin32 needed to use wexpect.

pip install pypiwin32

Dropping the wexpect.py file into your working directory is usually good enough instead of installing.

Usage

See pexpect examples for usage.

Release files for wexpect 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wexpect 0.0.1
File Size Uploaded Provenance Actions
wexpect-0.0.1.tar.gz 31.2 kB Without provenance Details for wexpect-0.0.1.tar.gz

Release files / wexpect-0.0.1.tar.gz

Download URL wexpect-0.0.1.tar.gz
Size 31.2 kB
Tags Source
SHA-256 checksum
How to use checksums
714053ea50b35908a4ce34f7a5f1ab43230e433ca96773c6d9595c17d1486fe2
BLAKE2b-256 checksum
How to use checksums
f0e295843284721803180d00006399a9f24105a6e0f4c88d5db972c68298cfba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

Security for wexpect 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page