Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Evilran opened this issue Oct 22, 2020 · 6 comments · Fixed by #247
Closed

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

Evilran opened this issue Oct 22, 2020 · 6 comments · Fixed by #247

Comments

@Evilran
Copy link

Evilran commented Oct 22, 2020

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.

@mxschmitt
Copy link
Member

mxschmitt commented Oct 22, 2020

@Evilran did you try it locally after adding AttributeError to your local playwright/main.py and did it work?

Sounds good to me that we can add it.

@Evilran
Copy link
Author

Evilran commented Oct 22, 2020

@mxschmitt I did that before and it works as expected! I think it would be nice if you could change it in the next stable version of playwright-python package 👍

@mxschmitt
Copy link
Member

@mxschmitt I did that before and it works as expected! I think it would be nice if you could change it in the next stable version of playwright-python package 👍

Cool thanks for confirming, will adjust it.

@mxschmitt
Copy link
Member

@Evilran released version 0.151.1 https://pypi.org/project/playwright/0.151.1/

@Evilran
Copy link
Author

Evilran commented Oct 23, 2020

@Evilran released version 0.151.1 https://pypi.org/project/playwright/0.151.1/

Awesome work, cool!

@yswtrue
Copy link

yswtrue commented Dec 25, 2020

it seems not to work in 0.171.0 and celery 4.47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants