wexpect | Windows variant of pexpect | Automation library

 by   raczben Python Version: 4.0.1.dev9 License: MIT

kandi X-RAY | wexpect Summary

kandi X-RAY | wexpect Summary

wexpect is a Python library typically used in Telecommunications, Media, Advertising, Marketing, Automation applications. wexpect has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can install using 'pip install wexpect' or download it from GitHub, PyPI.

Wexpect is a Python module for spawning child applications and controlling 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 scripts for duplicating software package installations on different servers. It can be used for automated software testing. Wexpect is in the spirit of Don Libes' Expect, but Wexpect is pure Python. Other Expect-like modules for Python require TCL and Expect or require C extensions to be compiled. Wexpect does not use C, Expect, or TCL extensions. Original Pexpect should work on any platform that supports the standard Python pty module. While Wexpect works on Windows platforms. The Wexpect interface focuses on ease of use so that simple tasks are easy.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              wexpect has a highly active ecosystem.
              It has 40 star(s) with 13 fork(s). There are 5 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 15 open issues and 31 have been closed. On average issues are closed in 142 days. There are no pull requests.
              OutlinedDot
              It has a negative sentiment in the developer community.
              The latest version of wexpect is 4.0.1.dev9

            kandi-Quality Quality

              wexpect has 0 bugs and 0 code smells.

            kandi-Security Security

              wexpect has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              wexpect code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              wexpect is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              wexpect releases are not available. You will need to build from source code and install.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed wexpect and discovered the below as its top functions. This is intended to give you an instant insight into wexpect implemented functionality, and help decide if they suit your requirements.
            • Spawn a child process
            • Start a new child process
            • Spawn a new child process
            • Switch to the console
            • Run the given command
            • Spawn a new process
            • Read loop
            • Check if process is alive
            • Start a child process
            • Joins a list of arguments
            • Implementation of write
            • Searches for pattern matching patterns
            • Read data from the cursor
            • Terminate programmatically
            • Send data to socket
            • Send EOF
            • Terminate the EOF
            • Read lines from the file
            • Terminate command
            • Read data from the file
            • Test the command to set echo echo
            • Wait for the screen to finish
            • Test the cmd executable
            • Expect pattern_list
            • Read data from the socket
            • Read up to size bytes
            Get all kandi verified functions for this library.

            wexpect Key Features

            No Key Features are available at this moment for wexpect.

            wexpect Examples and Code Snippets

            wexpect,Usage
            Pythondot img1Lines of Code : 12dot img1License : Permissive (MIT)
            copy iconCopy
            import wexpect
            
            prompt = '[A-Z]\:.+>'
            
            child = wexpect.spawn('cmd.exe')
            child.expect(prompt)    # Wait for startup prompt
            
            child.sendline('dir')   # List the current directory
            child.expect(prompt)
            
            print(child.before)     # Print the list
            child.se  
            wexpect,Install
            Pythondot img2Lines of Code : 1dot img2License : Permissive (MIT)
            copy iconCopy
            pip install wexpect
              

            Community Discussions

            QUESTION

            How to automatically feed command line input into python program
            Asked 2020-Aug-21 at 14:48

            I have inherited a program made by someone else which makes considerable effort to be "interactive", using the following kind of syntax:

            x = input("What is the value of x")

            There are dozens of input statements in nested if blocks. To start refactoring this program I need to set up some benchmarks which can cover the whole code and automatically input all combinations of user input.

            What is a quick way to get the program to accept user input via a python script?

            EDIT

            I have tried the windows alternative to pexpect which seems to work OK.

            ...

            ANSWER

            Answered 2020-Aug-21 at 10:36

            You have few options:

            • load a config file
            • use cli arguments (sys.argv)
            • use env variables (os.getenv(..))

            I would go with getting 1 input from the caller. This input points to a config file (json,yaml,ini) that holds rest of the input you need. So you will change the logic of the code and ask fro the user input only when you can data in the config. Example:

            Source https://stackoverflow.com/questions/63520890

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install wexpect

            You can install using 'pip install wexpect' or download it from GitHub, PyPI.
            You can use wexpect like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install wexpect

          • CLONE
          • HTTPS

            https://github.com/raczben/wexpect.git

          • CLI

            gh repo clone raczben/wexpect

          • sshUrl

            git@github.com:raczben/wexpect.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link