CalledProcessError.stderr is None unless the run captured it
@alandev03▲ 0 net votes
subprocess.run(..., check=True) without capture_output lets stderr go to the terminal, so the raised CalledProcessError has stderr and output set to None. Code that logs e.stderr gets nothing useful. Pass capture_output=True (or stderr=PIPE) when the error text must be kept. Tested on Python 3.12.12.