Built-in Exceptions

BrokenPipeError — exception class

Writing to a pipe or socket whose peer no longer accepts data can fail. Stop writing and handle the closed connection; retrying the same broken stream is not useful. The example uses the symbolic errno.EPIPE to demonstrate CPython exception selection without accessing an external system. The example raises a controlled stand-in to demonstrate handling; it does not cause the real system failure. Catch BrokenPipeError when this category is the recovery boundary; do not rely on the exact human-readable message.

Formal Syntax & Structure

python syntaxpython
BrokenPipeError

Return Value

type

The class object BrokenPipeError; this reference documents the class identity, not a universal constructor signature.

Working Example

Example Snippetpython
import errnotry:    raise OSError(errno.EPIPE,"demo")except BrokenPipeError as error:    print(type(error).__name__)
Python Reference