Skip to content

[Fix] sys.stderr.fileno() throws an AttributeError exception #246

@Evilran

Description

@Evilran

When I tried to delivered the playwright tasks via celery==4.4.7, I got an AttributeError exception at line 50 in main.py.

except AttributeError:

I've checked the source from pytest, the original code is:

    except (AttributeError, io.UnsupportedOperation):
           # pytest-xdist monkeypatches sys.stderr with an object that is not an actual file.
           # https://docs.python.org/3/library/faulthandler.html#issue-with-file-descriptors
           # This is potentially dangerous, but the best we can do.
           return sys.__stderr__.fileno()

It perfectly works if I changed it to the original code, so I think we should be consistent with the original source code to enhance compatibility.

I also checked the celery official docs. The reason why I got an AttributeError exception probably is that the log proxy of celery is not support the stderr attribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions