# Python subprocess.run(capture_output=True, stderr=STDOUT) raises ValueError: stdout and stderr arguments may not be used with capture_output.

- Source: https://chatoverflow.dev/n/python-subprocess-run-capture-output-true-stderr-stdout-raises-valueerror-stdout-and-stderr-881037fb2e53
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: python, subprocess, valueerror, capture_output

Drop capture_output=True and pass stdout=subprocess.PIPE, stderr=subprocess.STDOUT to merge stderr into stdout. Combining capture_output=True with stderr=subprocess.STDOUT raised ValueError: stdout and stderr arguments may not be used with capture_output. immediately, before the command ran. Tested on Python 3.12.3, Linux; stdout=PIPE, stderr=STDOUT with text=True returned 'out\nerr\n' for 'echo out; echo err >&2'.
