{"id":28309,"library":"subprocess-multitee","title":"subprocess-multitee","description":"Provides a `multitee` function that splits stdout/stderr from subprocesses into multiple sinks (e.g., files, pipes, callables), along with a `Popen` wrapper. Currently at v0.2.1, requires Python >= 3.6. Low release cadence; last release Nov 2023.","status":"active","version":"0.2.1","language":"python","source_language":"en","source_url":"https://github.com/JasonGross/subprocess-multitee","tags":["subprocess","tee","stdout","stderr","popen"],"install":[{"cmd":"pip install subprocess-multitee","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Used only in Python < 3.8 for `Literal` typing hint","package":"typing_extensions","optional":true}],"imports":[{"note":"multitee is directly exposed from the package root","wrong":"from subprocess_multitee.multitee import multitee","symbol":"multitee","correct":"from subprocess_multitee import multitee"},{"note":"The built-in subprocess.Popen does not have multitee support; must use the wrapper","wrong":"from subprocess import Popen","symbol":"Popen","correct":"from subprocess_multitee import Popen"}],"quickstart":{"code":"from subprocess_multitee import multitee, Popen\n\n# Capture stdout and stderr to both a list and a file\nout = []\nerr = []\nproc = Popen(\n    ['echo', 'hello'],\n    stdout=multitee(lambda line: out.append(line), open('/tmp/stdout.log', 'w')),\n    stderr=multitee(lambda line: err.append(line), open('/tmp/stderr.log', 'w')),\n    text=True\n)\nproc.wait()\n","lang":"python","description":"Basic usage: split subprocess output into multiple sinks (callables, file objects, etc.) using the Popen wrapper."},"warnings":[{"fix":"Ensure sinks accept string lines when using text mode, or use bytes mode consistently.","message":"The `multitee` function expects writable objects that accept lines (e.g., file objects opened with 'w' and callables that take a string). Do not pass binary streams unless you set `text=True` in Popen.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to >=0.2.0.","message":"A bug in v0.1.1 and earlier could stall subprocess writes when reading single bytes. v0.2.0 resolved this by using an internal queue.","severity":"breaking","affected_versions":"<0.2.0"},{"fix":"Check the docs for supported parameters; fall back to raw `subprocess.Popen` if you need unsupported features.","message":"The `Popen` wrapper does not mirror the full `subprocess.Popen` interface. Arguments like `bufsize`, `pipesize`, or `pass_fds` may not be supported.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Reinstall: `pip install --upgrade subprocess-multitee` and import as `from subprocess_multitee import multitee`.","cause":"Trying to import from a stale cached installation or incorrect path.","error":"ImportError: cannot import name 'multitee' from 'subprocess_multitee'"},{"fix":"Upgrade to latest: `pip install --upgrade subprocess-multitee`.","cause":"Installed version is very old (<0.1.0?). Popen was added later.","error":"AttributeError: module 'subprocess_multitee' has no attribute 'Popen'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}