-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Azure CLI commands return character '[0m' at the end of the command output #9903
Comments
Howdy jlausuch, is this new to 2.0.68 or has this behavior been present for older versions as well? I suspect that the terminal you're using isn't playing nice with our colorizer. It would explain why an unexpected control character is being output, and also why it doesn't happen when you're not using an interactive terminal session. |
It didn't happen with version 2.0.64 actually. |
I have the same problem in pycharm.The version is 2.0.69. |
@charlesguoooo, is your platform also SUSE? |
@marstr no, It was happened in pycharm on mac. look this
But if not in pycharm,Just run |
I'm going to unassign myself, as this does not relate to the Packaging as originally believed. @zikalino, @yugangw-msft you guys may want to re-triage or re-assign this. |
Any updates on this issue? Still seeing this problem with az cli version 2.0.74 on mac when running in pycharm. |
Also observing trailing escape character in 2.0.70 in IntelliJ IDEA 2019.2 with above snippet, with or without |
@charlesguoooo @kh-sonrai , the issue on PyCharm isn't limited to CLI. We can test by creating from colorama import init
init() Then call it in import subprocess
result = subprocess.check_output("<python_path>\\python.exe <absolute_path>\\printcolor.py")
decoded = result.decode(encoding='UTF-8')
print(decoded) The actual output is empty but when debugging into it, we can see
This is because colorama registers |
We are not able to reproduce with docker on Mac.
Are you running docker on Windows, Linux or Mac? If you run |
Okay, I know what the problem is. My The Sorry for the false alarm. |
Thanks for the analysis. Per docker's doc,
This makes colorama think this is a tty and thus send the escaping chars. |
Why does the azure-cli even output control characters when I request json output? And how can I turn this off? This is breaking my scripts |
It is still happening in az cli 2.5.1 (only in pycharm) and actually it is breaking DefaultAzureCredential (azure-identity 1.4.0b2) as it cannot parse token from az output (json.decoder.JSONDecodeError: Extra data) |
@marcin-vt, could you try disabling the color following #12601 and see if it still happens? |
Thnx @jiasli - that helped! |
@marcin-vt was your issue resolved? |
Mine? Yes, adding the environmental variable solved the issue. |
I have created issue tartley/colorama#263 on colorama's repo. |
The Azure CLI supports colored output by using colorama which resets the color after execution by printing "[0m" if the terminal supports color. This can in some cases cause the AzureCliCredential to fail for example when developing in PyCharm: Azure/azure-cli#9903 Azure CLI allows color output to be disabled by setting the environment variable:AZURE_CORE_NO_COLOR. The PR in azure-cli: Azure/azure-cli#12601
On azure-cli 2.35.0 and VSCode 1.66.2 is still preset
Resolved setting |
Describe the bug
I get the char sequence '[0m' at the end of the command output.
To Reproduce
any
az
command.It doesn't happen if the command is pipped or redirected to a file.
Expected behavior
It should not print that character.
Environment summary
Additional context
The text was updated successfully, but these errors were encountered: