delegator

raw JSON →
0.1.1 verified Mon Apr 27 auth: no python deprecated

Subprocesses for Humans 2.0, built on top of pexpect and shiv. Latest version 0.1.1 (unmaintained). No recent releases since 2015.

pip install delegator-py
error AttributeError: module 'delegator' has no attribute 'run'
cause Incorrect import: trying to import run directly or wrong module name.
fix
Install via pip install delegator-py, then use import delegator and delegator.run().
error TypeError: run() got an unexpected keyword argument 'block'
cause delegator.run() does not have a block argument; it returns immediately.
fix
Do not pass block=True; instead call .block() on the returned Command object.
deprecated Library is no longer maintained. Consider using json, subprocess, or invoke instead.
fix Migrate to subprocess.run() or invoke.
gotcha delegator.run() returns a Command object immediately, not waiting for the process to finish. Access .block() or .out/.err to synchronize.
fix Ensure you call .block() or access .out after the process completes.
gotcha On Windows, pexpect may not work; delegator may behave differently.
fix Use on Unix-like systems or test thoroughly on Windows.

Basic usage: run non-blocking subprocesses with output capture and interactivity.

import delegator

# Run a command and get output
c = delegator.run('echo hello')
print(c.out)  # hello

# Interactive command with timeout
try:
    c = delegator.run('python', timeout=3)
    c.expect('>>>')
    c.writeline('print(1+1)')
    c.expect('2')
    print(c.after)
except Exception as e:
    print(f"Error: {e}")