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
Sanic colors with python 3.11 displayed incorrectly #2589
Comments
I can get the issue to fix if I change the This item from the python3.11 changelog may be the root cause:
I think a quick fix for this would maybe something like this (untested but hopefully gets the point across): import sys
if sys.version_info < (3, 11, 0):
from enum import Enum
class StrEnum(str, Enum): pass
else:
from enum import StrEnum
...
class Colors(StrEnum):
... Another fix may be to manually restore the old behavior of class Colors(str, Enum): # no cov
...
def __format__(self, format_spec: str) -> str:
return self.value + format_spec |
Yes, the StrEnum fix is exactly something I've been planning once it was available. Happy to see you make a PR with this! 😎 |
Co-authored-by: Adam Hopkins <adam@amhopkins.com> Fixes sanic-org#2589
Is there an existing issue for this?
Describe the bug
Using Python3.11, the DEBUG message when starting the server shows:
This is fairly minor issue but could be a note of a larger issue.
Code snippet
No response
Expected Behavior
No response
How do you run Sanic?
As a script (
app.run
orSanic.serve
)Operating System
Linux
Sanic Version
22.9.0
Additional context
Using Python3.10 works correctly.
The text was updated successfully, but these errors were encountered: