Skip to content

az webpubsub client start errors with TypeError: As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary #4910

@asottile

Description

@asottile
  • If the issue is to do with Azure CLI 2.0 in-particular, create an issue here at Azure/azure-cli

Related command

$ az webpubsub client start --name twitch-pubsub --resource-group twitchRG --user user1 --hub-name hub1
The command failed with an unexpected error. Here is the traceback:
As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
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/anthony/.azure/cliextensions/webpubsub/azext_webpubsub/client.py", line 58, in start_client
    asyncio.get_event_loop().run_until_complete(connect(token['url']))
  File "/opt/az/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/anthony/.azure/cliextensions/webpubsub/azext_webpubsub/client.py", line 43, in connect
    async with websockets.connect(url, subprotocols=['json.webpubsub.azure.v1']) as ws:
  File "/home/anthony/.azure/cliextensions/webpubsub/websockets/client.py", line 517, in __aenter__
    return await self
  File "/home/anthony/.azure/cliextensions/webpubsub/websockets/client.py", line 535, in __await_impl__
    transport, protocol = await self._create_connection()
  File "/opt/az/lib/python3.10/asyncio/base_events.py", line 1089, in create_connection
    transport, protocol = await self._create_connection_transport(
  File "/opt/az/lib/python3.10/asyncio/base_events.py", line 1107, in _create_connection_transport
    protocol = protocol_factory()
  File "/home/anthony/.azure/cliextensions/webpubsub/websockets/client.py", line 69, in __init__
    super().__init__(**kwargs)
  File "/home/anthony/.azure/cliextensions/webpubsub/websockets/protocol.py", line 235, in __init__
    self._drain_lock = asyncio.Lock(
  File "/opt/az/lib/python3.10/asyncio/locks.py", line 78, in __init__
    super().__init__(loop=loop)
  File "/opt/az/lib/python3.10/asyncio/mixins.py", line 17, in __init__
    raise TypeError(
TypeError: As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary

Extension name (the extension in question)

webpubsub

Description of issue (in as much detail as possible)

appears this just needs an upgrade

I was able to work around by running (I'm in azure cloud shell):

/opt/az/bin/python3.10 -m pip install websockets --upgrade --target ~/.azure/cliextensions/webpubsub/

Metadata

Metadata

Assignees

No one assigned

    Labels

    CXP AttentionThis issue is handled by CXP team.WebPubSubcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions