diff --git a/playwright/_impl/_transport.py b/playwright/_impl/_transport.py index 1b9ef4d8e..beae9569b 100644 --- a/playwright/_impl/_transport.py +++ b/playwright/_impl/_transport.py @@ -33,6 +33,9 @@ # Sourced from: https://github.com/pytest-dev/pytest/blob/da01ee0a4bb0af780167ecd228ab3ad249511302/src/_pytest/faulthandler.py#L69-L77 def _get_stderr_fileno() -> Optional[int]: + if sys.stderr.closed: + return None + try: return sys.stderr.fileno() except (AttributeError, io.UnsupportedOperation):