AzureIoT Hub error "TypeError: gather() got an unexpected keyword argument 'loop'"
v-zzhe opened this issue · 4 comments
Describe the bug
Error "TypeError: gather() got an unexpected keyword argument 'loop'" when running below:
az iot hub monitor-events --hub-name <azure_iot_hub_name> --output table
To Reproduce
Steps to reproduce the behavior:
A. Create one IoTHub and start the Azure CLI in Cloud Shell(There is a button to launch this shell at the top of the portal)
B. Install the Azure IoT Hub extension: az extension add --name azure-iot
C. Run the following command: az iot hub monitor-events --hub-name <azure_iot_hub_name> --output table, and received below error:
Dependency update (uamqp 1.2) required for IoT extension version: 0.10.15.
Continue? (y/n) -> y
Updating required dependency...
Update complete. Executing command...
The command failed with an unexpected error. Here is the traceback:
gather() got an unexpected keyword argument 'loop'
Traceback (most recent call last):
File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute
raise ex
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 333, in call
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/home/zhe/.azure/cliextensions/azure-iot/azext_iot/operations/hub.py", line 2957, in iot_hub_monitor_events
_iot_hub_monitor_events(
File "/home/zhe/.azure/cliextensions/azure-iot/azext_iot/operations/hub.py", line 3098, in _iot_hub_monitor_events
start_single_monitor(
File "/home/zhe/.azure/cliextensions/azure-iot/azext_iot/monitor/telemetry.py", line 34, in start_single_monitor
return start_multiple_monitors(
File "/home/zhe/.azure/cliextensions/azure-iot/azext_iot/monitor/telemetry.py", line 68, in start_multiple_monitors
future = asyncio.gather(*coroutines, loop=loop, return_exceptions=True) # pylint: disable=deprecated-argument
TypeError: gather() got an unexpected keyword argument 'loop'
To open an issue, please run: 'az feedback'
sys:1: RuntimeWarning: coroutine '_initiate_event_monitor' was never awaited
Expected behavior
Get telemetry without error
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- OS: [e.g. Windows 10, Ubuntu 16.04, MacOS X]
- Shell: [e.g. bash, wsl bash, powershell, cmd]
- Az CLI version: [e.g. 2.0.80]
- IoT extension version: [e.g. 0.9.1]
- Python version (if pip installed): [e.g. 3.8.1]
Additional context
Add any other context about the problem here.
@v-zzhe Please update your Azure CLI and azure-iot
extension versions to resolve the issue https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
You need at least version 0.12.0
of the azure-iot
extension which requires a min Az CLI version of 2.17.1
but we highly recommend at least Az CLI version 2.30.0
. The latest is 2.38.0
.
We haven't heard back from you. Let us know if after upgrading your Azure CLI and azure-iot
extension versions you still run into this issue.
Verified, thanks!