[Fix] sys.stderr.fileno() throws an AttributeError exception
See original GitHub issueWhen 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.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Calling sys.stderr.fileno(), after checking it is a python callable ...
Calling sys.stderr.fileno(), after checking it is a python callable(), raises an AttributeError? · According to python docs (docs.python.org/2/ ...
Read more >Issue 5492: Error on leaving IDLE with quit() or exit() under ...
fileno(), which raises the above. This is from #9290. Bottom line: I believe quit() and exit() are broken in the current 2.7, 3.2,...
Read more >mod_wsgi Documentation - Read the Docs
The mod_wsgi package implements a simple to use Apache module which can host any Python web application which supports the Python ...
Read more >python-pytest-3.3.2-bp150.2.4 - SUSE Package Hub -
(#2644) - Fix error on Windows and Python 3.6+ when sys.stdout has been replaced with a stream-like object which does not implement the...
Read more >Release notes for Python 3.5.4
bpo-30301: Fix AttributeError when using SimpleQueue.empty() under *spawn* and ... bpo-25182: The stdprinter (used as sys.stderr before the io module is ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Evilran released version 0.151.1 https://pypi.org/project/playwright/0.151.1/
it seems not to work in 0.171.0 and celery 4.47