You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue #2031 not fixed. It still tries to use colorama when not requested and not installed
I'm still getting this error on isort version6.0.0b2. See also confirmed from others here
It looks like the fix that went in isn't working in my case. The added line colorama.init(strip=False) fails in format.py line 153.
It gets called even when color is False AND color_unavailable is True, which then doesn't trigger the sorry msg due to the AND condition evaluating to False. I have confirmed this is what has been happening in my case at least
See failing function below for more context
defcreate_terminal_printer(
color: bool, output: Optional[TextIO] =None, error: str="", success: str=""
) ->BasicPrinter:
ifcolorandcolorama_unavailable:
no_colorama_message= (
"\n""Sorry, but to use --color (color_output) the colorama python package is required.\n\n""Reference: https://pypi.org/project/colorama/\n\n""You can either install it separately on your system or as the colors extra ""for isort. Ex: \n\n""$ pip install isort[colors]\n"
)
print(no_colorama_message, file=sys.stderr)
sys.exit(1)
colorama.init(strip=False)
return (
ColoramaPrinter(error, success, output) ifcolorelseBasicPrinter(error, success, output)
)
Failing trace
Traceback (most recent call last):
File "/home/runner/.local/share/virtualenvs/python-fi6_LwSQ/lib/python3.8/site-packages/isort/main.py", line 87, in sort_imports
incorrectly_sorted = not api.check_file(file_name, config=config, **kwargs)
File "/home/runner/.local/share/virtualenvs/python-fi6_LwSQ/lib/python3.8/site-packages/isort/api.py", line 338, in check_file
return check_stream(
File "/home/runner/.local/share/virtualenvs/python-fi6_LwSQ/lib/python3.8/site-packages/isort/api.py", line 272, in check_stream
printer = create_terminal_printer(
File "/home/runner/.local/share/virtualenvs/python-fi6_LwSQ/lib/python3.8/site-packages/isort/format.py", line 153, in create_terminal_printer
colorama.init(strip=False)
NameError: name 'colorama' is not defined
The text was updated successfully, but these errors were encountered:
Not sure if this is the same, but I've got GitHub Actions failing in a Ubuntu runtime with Python 3.10.13 that tries to run these commands, but fails on the second:
Issue #2031 not fixed. It still tries to use colorama when not requested and not installed
I'm still getting this error on isort version
6.0.0b2
. See also confirmed from others hereIt looks like the fix that went in isn't working in my case. The added line
colorama.init(strip=False)
fails in format.py line 153.It gets called even when
color
is False ANDcolor_unavailable
is True, which then doesn't trigger the sorry msg due to the AND condition evaluating to False. I have confirmed this is what has been happening in my case at leastSee failing function below for more context
Failing trace
The text was updated successfully, but these errors were encountered: