{"id":4939,"library":"easyprocess","title":"EasyProcess","description":"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.","status":"active","version":"1.1","language":"en","source_language":"en","source_url":"https://github.com/ponty/EasyProcess","tags":["subprocess","process management","automation","shell"],"install":[{"cmd":"pip install EasyProcess","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"symbol":"EasyProcess","correct":"from easyprocess import EasyProcess"}],"quickstart":{"code":"import sys\nfrom easyprocess import EasyProcess\n\n# Get the Python executable path\npython_executable = sys.executable\n\n# Run a simple Python command, wait for it, and get stdout\nprocess_result = EasyProcess([python_executable, \"-c\", \"print('Hello from EasyProcess')\"]).call()\nprint(\"Stdout:\", process_result.stdout)\nprint(\"Return Code:\", process_result.return_code)","lang":"python","description":"This example demonstrates how to run a simple Python command using EasyProcess, wait for its completion, and retrieve its standard output and return code."},"warnings":[{"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.","message":"EasyProcess 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Access `stdout` and `stderr` only after the process has concluded, for instance, after calling `.call()` or after `.stop()` on a `start()`ed process.","message":"The `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`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Check `return_code` only after the process has completed and the relevant method (`stop()` or `wait()`) has been invoked.","message":"The `return_code` attribute is `None` until the managed subprocess has completed its execution and either `EasyProcess.stop()` or `EasyProcess.wait()` has been called.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"The `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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}