zut.process.ProcessError
- exception zut.process.ProcessError(original_error: CalledProcessError | None = None, *, returncode: int | None = None, cmd: str | Sequence | None = UNSET, stdout: str | bytes | None = UNSET, stderr: str | bytes | None = UNSET, maxlen: int | None = UNSET)
Extended and configurable version of CalledProcessError (of module subprocess of the standard library), displaying stderr and stdout in the error message.
This class is automatically used by run_process, run_process_callback and verify_run_process (of module zut.process). It can also be used when manually using subprocess. Example:
- try:
value = subprocess.check_output([‘gpg’, ‘–quiet’, ‘–batch’, ‘–no-tty’, ‘–decrypt’, path], text=True, encoding=’utf-8’, stderr=subprocess.PIPE)
- except subprocess.CalledProcessError as err:
from zut.process import ProcessError raise ProcessError(err, cmd=’gpg –decrypt’) from None