Skip to content

az container exec - does not work again - TypeError: write() argument must be str, not bytes #18251

@alexeyshishkin01

Description

@alexeyshishkin01

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug

az container exec \

--resource-group dockers
--name debiandocker
--exec-command "/bin/bash"
--container-name debiandocker
The command failed with an unexpected error. Here is the traceback:
write() argument must be str, not bytes
Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 657, in execute
raise ex
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 720, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 691, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 328, in call
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/container/custom.py", line 623, in container_exec
_start_exec_pipe(execContainerResponse.web_socket_uri, execContainerResponse.password)
File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/container/custom.py", line 666, in _start_exec_pipe
if not _cycle_exec_pipe(ws):
File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/container/custom.py", line 684, in _cycle_exec_pipe
sys.stdout.write(data)
TypeError: write() argument must be str, not bytes

To Reproduce

To reproduce - create Azure Container and run 'az container exec'

Expected behavior

Expected behavior - no such issue, connect to container instead

Environment summary

root@Alexey-HP:~# az --version
azure-cli 2.24.0
core 2.24.0
telemetry 1.0.6
Python location '/opt/az/bin/python3'
Extensions directory '/root/.azure/cliextensions'
Python (Linux) 3.6.10 (default, May 21 2021, 07:23:15)
[GCC 9.3.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.

Additional context

The issue did not exist in the mid of April 2021

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions