Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.98k forks source link

'charmap' codec can't encode characters in position 258-264: character maps to <undefined> #21703

Open ubexplorer opened 2 years ago

ubexplorer commented 2 years ago

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az container logs

Errors:

The command failed with an unexpected error. Here is the traceback:
'charmap' codec can't encode characters in position 258-264: character maps to <undefined>
Traceback (most recent call last):
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 658, in execute
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 692, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/container/custom.py", line 560, in container_logs
  File "encodings\cp1251.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode characters in position 258-264: character maps to <undefined>

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

Expected Behavior

Environment Summary

Windows-10-10.0.19041-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.34.1

Additional Context

yonzhan commented 2 years ago

route to CXP team

SaurabhSharma-MSFT commented 2 years ago

@SerhiiZavalko Is your resource name containing any Unicode characters?

ubexplorer commented 2 years ago

@SaurabhSharma-MSFT No, but I suppose stdout containing such characters. This error occurs only with az logs command.

ghost commented 2 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @macolso.

Issue Details
### **This is autogenerated. Please review and update as needed.** ## Describe the bug **Command Name** `az container logs` **Errors:** ``` The command failed with an unexpected error. Here is the traceback: 'charmap' codec can't encode characters in position 258-264: character maps to Traceback (most recent call last): File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 658, in execute File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 692, in _run_job File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__ File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/container/custom.py", line 560, in container_logs File "encodings\cp1251.py", line 19, in encode UnicodeEncodeError: 'charmap' codec can't encode characters in position 258-264: character maps to ``` ## To Reproduce: Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information. - _Put any pre-requisite steps here..._ - `az container logs --resource-group {} --name {}` ## Expected Behavior ## Environment Summary ``` Windows-10-10.0.19041-SP0 Python 3.8.9 Installer: MSI azure-cli 2.34.1 ``` ## Additional Context
Author: SerhiiZavalko
Assignees: SaurabhSharma-MSFT
Labels: `Service Attention`, `Container Instances`, `customer-reported`, `Auto-Assign`
Milestone: -
esdccs1 commented 1 year ago

This happned to me as well, I was trying to build a docker container on a windows VM targeting a linux environment

UnicodeEncodeError: 'charmap' codec can't encode character '\u2192' in position 3564: character maps to <undefined>
idrisfl commented 7 months ago

Got the same error as @esdccs1 where I am on a windows VM targeting a linux environment ERROR: The command failed with an unexpected error. Here is the traceback: ERROR: 'charmap' codec can't encode characters in position 1977-2016: character maps to Traceback (most recent call last): File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 664, in execute File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 731, in _run_jobs_serially File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 701, in _run_job File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 334, in call File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acr/build.py", line 143, in acr_build File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acr/_stream_utils.py", line 58, in stream_logs File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acr/_stream_utils.py", line 143, in _stream_logs File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\colorama/ansitowin32.py", line 47, in write File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\colorama/ansitowin32.py", line 177, in write File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\colorama/ansitowin32.py", line 202, in write_and_convert File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\colorama/ansitowin32.py", line 210, in write_plain_text File "encodings\cp1252.py", line 19, in encode UnicodeEncodeError: 'charmap' codec can't encode characters in position 1977-2016: character maps to

Any updates? or a workaround?

klemmchr commented 3 months ago

Having same issue on Windows

22:14:52 [DBG] ERROR: The command failed with an unexpected error. Here is the traceback:
22:14:52 [DBG] (Reading database ... 10312 files and directories currently installed.)
22:14:52 [DBG]
22:14:52 [DBG] Preparing to unpack .../00-python3_3.8.2-0ubuntu2_amd64.deb ...
22:14:52 [DBG]
22:14:52 [DBG] ERROR: 'charmap' codec can't encode character '\u2192' in position 516: character maps to <undefined>
22:14:52 [DBG] Unpacking python3 (3.8.2-0ubuntu2) ...
22:14:52 [DBG] Traceback (most recent call last):
22:14:52 [DBG]
22:14:52 [DBG]   File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
22:14:52 [DBG] Selecting previously unselected package libapparmor1:amd64.
22:14:52 [DBG]   File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 664, in execute
22:14:52 [DBG]
22:14:52 [DBG]   File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 731, in _run_jobs_serially
22:14:52 [DBG] Preparing to unpack .../01-libapparmor1_2.13.3-7ubuntu5.3_amd64.deb ...
22:14:52 [DBG]   File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 701, in _run_job
22:14:52 [DBG]
22:14:52 [DBG]   File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 334, in __call__
22:14:52 [DBG] Unpacking libapparmor1:amd64 (2.13.3-7ubuntu5.3) ...
22:14:52 [DBG]   File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
22:14:52 [DBG]
22:14:52 [DBG]   File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acr/build.py", line 143, in acr_build
22:14:52 [DBG] Selecting previously unselected package libcap2:amd64.
22:14:52 [DBG]   File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acr/_stream_utils.py", line 58, in stream_logs
22:14:52 [DBG]
22:14:52 [DBG]   File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acr/_stream_utils.py", line 143, in _stream_logs
22:14:52 [DBG] Preparing to unpack .../02-libcap2_1%3a2.32-1ubuntu0.1_amd64.deb ...
22:14:52 [DBG]   File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\colorama/ansitowin32.py", line 47, in write
22:14:52 [DBG]
22:14:52 [DBG]   File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\colorama/ansitowin32.py", line 177, in write
22:14:52 [DBG] Unpacking libcap2:amd64 (1:2.32-1ubuntu0.1) ...
22:14:52 [DBG]   File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\colorama/ansitowin32.py", line 205, in write_and_convert
22:14:52 [DBG]
22:14:52 [DBG]   File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\colorama/ansitowin32.py", line 210, in write_plain_text
22:14:52 [DBG] Selecting previously unselected package libargon2-1:amd64.
22:14:52 [DBG]   File "encodings\cp1252.py", line 19, in encode