Registry / devops / easyprocess

easyprocess

JSON →
library1.1pypypi✓ verified 23d ago

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 EasyProcess
INSTALL
IMPORT
SIG · EASYPROCESS
E
easyprocess
devopspythonv1.1
Install
1.8s avg
Import
46ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.048s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.044s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EasyProcess
from easyprocess import EasyProcess

This example demonstrates how to run a simple Python command using EasyProcess, wait for its completion, and retrieve its standard output and return code.

import sys from easyprocess import EasyProcess # Get the Python executable path python_executable = sys.executable # Run a simple Python command, wait for it, and get stdout process_result = EasyProcess([python_executable, "-c", "print('Hello from EasyProcess')"]).call() print("Stdout:", process_result.stdout) print("Return Code:", process_result.return_code)
Debug
Known issues
gotchaEasyProcess does not support shell commands. Commands should be provided as a list of arguments. Passing a string will be split using `shlex.split`, but shell-specific commands (like `echo` on Windows) might not work as expected if they are not standalone executables.
fix
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.
affects: All versions
gotchaThe `stdout` and `stderr` attributes of an `EasyProcess` object are only populated *after* the subprocess has finished execution (i.e., after `call()`, `wait()`, or `stop()` has completed and the process has terminated). Attempting to read them before the process ends will result in `None`.
fix
Access `stdout` and `stderr` only after the process has concluded, for instance, after calling `.call()` or after `.stop()` on a `start()`ed process.
affects: All versions
gotchaThe `return_code` attribute is `None` until the managed subprocess has completed its execution and either `EasyProcess.stop()` or `EasyProcess.wait()` has been called.
fix
Check `return_code` only after the process has completed and the relevant method (`stop()` or `wait()`) has been invoked.
affects: All versions
gotchaThe `stop()` method only terminates the main process started by `EasyProcess` and does *not* automatically kill the entire subprocess tree (i.e., any child processes spawned by the main process). This can lead to orphaned processes.
fix
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.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'easyprocess'
The 'easyprocess' library is not installed in your Python environment or is not accessible within the current Python path.
fix
Install the library using pip: `pip install easyprocess`
easyprocess.EasyProcessCheckInstalledError: cmd=['Xvfb', '-help'] OSError=[Errno 2] No such file or directory
The `easyprocess` library, often used by other libraries like `pyvirtualdisplay`, attempts to execute an external command (e.g., `Xvfb` or `Xephyr`) that is not installed on the operating system.
fix
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.
ImportError: cannot import name 'Proc' from 'easyprocess'
The class or function named 'Proc' is not part of the public API or has been renamed/removed in the version of `easyprocess` you are using. The primary class for creating subprocesses is `EasyProcess`.
fix
Use the `EasyProcess` class instead: `from easyprocess import EasyProcess`
CalledProcessError: Command '['some_command', 'arg1']' returned non-zero exit status X.
The external command executed by `easyprocess` (which wraps Python's `subprocess` module) exited with a non-zero status code, indicating an error during the command's execution.
fix
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)`.
Upgrade
Version history
1.1latest on PyPI · released Jan 15, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
easyprocess — pip install easyprocess · libregistry