EasyProcess is a simple, easy-to-use Python subprocess interface, providing a convenient layer on top of the standard `subprocess` module. It simplifies starting and stopping programs, retrieving their standard output and error streams, and managing return codes. The library supports Python versions 3.7 through 3.12 and is currently at version 1.1.
pip install EasyProcessVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to run a simple Python command using EasyProcess, wait for its completion, and retrieve its standard output and return code.
Always pass commands as a list of strings (e.g., `['command', 'arg1', 'arg2']`) instead of a single string. Ensure the base command refers to an actual executable.
Access `stdout` and `stderr` only after the process has concluded, for instance, after calling `.call()` or after `.stop()` on a `start()`ed process.
Check `return_code` only after the process has completed and the relevant method (`stop()` or `wait()`) has been invoked.
For scenarios requiring full process tree termination, consider external utilities (like `psutil` in Python) to identify and kill child processes, or ensure the executed program itself handles its child processes gracefully.
Install the library using pip: `pip install easyprocess`
Install the missing external program using your system's package manager (e.g., `sudo apt-get install xvfb` on Debian/Ubuntu, or `sudo yum install xorg-x11-server-Xvfb` on CentOS/RHEL) or ensure it's in your system's PATH.
Use the `EasyProcess` class instead: `from easyprocess import EasyProcess`
Examine the `stderr` and `stdout` attributes of the `EasyProcess` object for more details on why the command failed. Debug the external command directly in your terminal to understand its expected behavior and potential errors. You can access these like `process = EasyProcess(cmd).call(); print(process.stdout); print(process.stderr)`.
No dependency data recorded yet.