python-colorlog
python-colorlog copied to clipboard
Does not work on Python 3.13
Attempting to use colorlog 6.8.2 under Python 3.13.0 like so:
import logging
import sys
import colorlog
colorlog.basicConfig(
format="%(log_color)s[%(levelname)-8s] %(message)s",
log_colors={
"DEBUG": "cyan",
"INFO": "bold",
"WARNING": "yellow",
"ERROR": "red",
"CRITICAL": "bold_red",
},
level=logging.DEBUG,
stream=sys.stderr,
)
logging.info("Hello, world!")
results in the following error:
Traceback (most recent call last):
File "/Users/jwodder/work/sand/python/libraries/colorlog-13.py", line 5, in <module>
colorlog.basicConfig(
~~~~~~~~~~~~~~~~~~~~^
format="%(log_color)s[%(levelname)-8s] %(message)s",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<8 lines>...
stream=sys.stderr,
^^^^^^^^^^^^^^^^^^
)
^
File "/Users/jwodder/.local/virtualenvwrapper/venvs/tmp-a8febeefddd48eb/lib/python3.13/site-packages/colorlog/wrappers.py", line 56, in basicConfig
logging._acquireLock() # type: ignore
^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'logging' has no attribute '_acquireLock'
I think I've got a patch for this that I couldn't release at the time. I'll try and get that out soon.
Should be fixed in 6.9.0, thanks for the issue!