Skip to content

PortInUseError(port)

Bases: OSError

Raised when a desired port is in use.

Create an error for a port that's in use.

Parameters:

Name Type Description Default
port int

Port that's in use.

required
Source code in src/notwork/exceptions/port_in_use_error.py
def __init__(self, port: int) -> None:
    """
    Create an error for a port that's in use.

    Args:
        port: Port that's in use.
    """
    super().__init__(
        EADDRINUSE,
        strerror(EADDRINUSE),
    )

    self.port = port
    """The port that's in use."""

port = port instance-attribute

The port that's in use.