smurfix / asyncari

Asterisk Resource Interface for Trio
Other
7 stars 3 forks source link

Errors in example #3

Closed Regela closed 3 years ago

Regela commented 3 years ago

When i trying to run any example, i see this error:

/usr/bin/python3.9 /home/regela/Workspace/RedStart/ARIExample/main.py
DEBUG:asyncswagger11.client:Loading from http://localhost:8088/ari/api-docs/resources.json
DEBUG:asyncswagger11.client:eventWebsocket?'app=hello'
DEBUG:asyncswagger11.client:GET http://localhost:8088/ari/events({'app': 'hello'})
Traceback (most recent call last):
  File "/home/regela/Workspace/RedStart/ARIExample/main.py", line 79, in <module>
    anyio.run(main, backend="trio")
  File "/usr/lib/python3.9/site-packages/anyio/_core/_eventloop.py", line 53, in run
    return asynclib.run(func, *args, **backend_options)  # type: ignore
  File "/usr/lib/python3.9/site-packages/trio/_core/_run.py", line 1932, in run
    raise runner.main_task_outcome.error
  File "/home/regela/Workspace/RedStart/ARIExample/main.py", line 73, in main
    print("** EVENT **", m)
  File "/usr/lib/python3.9/site-packages/async_generator/_util.py", line 53, in __aexit__
    await self._agen.athrow(type, value, traceback)
  File "/usr/lib/python3.9/site-packages/asyncari/__init__.py", line 41, in connect
    pass # end taskgroup
  File "/usr/lib/python3.9/site-packages/anyio/_backends/_trio.py", line 151, in __aexit__
    raise ExceptionGroup(exc.exceptions) from None
anyio._backends._trio.ExceptionGroup: 3 exceptions were raised in the task group:
----------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/asyncari/__init__.py", line 37, in connect
    yield client
  File "/home/regela/Workspace/RedStart/ARIExample/main.py", line 72, in main
    async for m in client:
  File "/usr/lib/python3.9/site-packages/asyncari/client.py", line 146, in __aiter__
    self._reader.open()
  File "/usr/lib/python3.9/site-packages/asyncari/client.py", line 51, in open
    self.q = anyio.create_queue(10)
AttributeError: module 'anyio' has no attribute 'create_queue'
----------------------------
Traceback (most recent call last):
  File "/home/regela/Workspace/RedStart/ARIExample/main.py", line 61, in on_start
    async with client.on_channel_event('StasisStart') as listener:
  File "/usr/lib/python3.9/site-packages/asyncari/client.py", line 60, in __aenter__
    self.open()
  File "/usr/lib/python3.9/site-packages/asyncari/client.py", line 51, in open
    self.q = anyio.create_queue(10)
AttributeError: module 'anyio' has no attribute 'create_queue'
----------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/asyncari/client.py", line 183, in _run
    ws = await self.swagger.events.eventWebsocket(app=apps)
  File "/usr/lib/python3.9/site-packages/asyncswagger11/client.py", line 110, in __call__
    ret = await self.http_client.ws_connect(uri, params=params,
  File "/usr/lib/python3.9/site-packages/asyncswagger11/http_client.py", line 237, in ws_connect
    ret = await create_websocket(url, headers=headers)
  File "/usr/lib/python3.9/site-packages/asyncwebsockets/client.py", line 59, in create_websocket
    ws = Websocket()
  File "/usr/lib/python3.9/site-packages/asyncwebsockets/websocket.py", line 30, in __init__
    self._send_lock = anyio.Lock()
AttributeError: module 'anyio' has no attribute 'Lock'

Details of embedded exception 1:

  Traceback (most recent call last):
    File "/usr/lib/python3.9/site-packages/asyncari/__init__.py", line 37, in connect
      yield client
    File "/home/regela/Workspace/RedStart/ARIExample/main.py", line 72, in main
      async for m in client:
    File "/usr/lib/python3.9/site-packages/asyncari/client.py", line 146, in __aiter__
      self._reader.open()
    File "/usr/lib/python3.9/site-packages/asyncari/client.py", line 51, in open
      self.q = anyio.create_queue(10)
  AttributeError: module 'anyio' has no attribute 'create_queue'

Details of embedded exception 2:

  Traceback (most recent call last):
    File "/home/regela/Workspace/RedStart/ARIExample/main.py", line 61, in on_start
      async with client.on_channel_event('StasisStart') as listener:
    File "/usr/lib/python3.9/site-packages/asyncari/client.py", line 60, in __aenter__
      self.open()
    File "/usr/lib/python3.9/site-packages/asyncari/client.py", line 51, in open
      self.q = anyio.create_queue(10)
  AttributeError: module 'anyio' has no attribute 'create_queue'

Details of embedded exception 3:

  Traceback (most recent call last):
    File "/usr/lib/python3.9/site-packages/asyncari/client.py", line 183, in _run
      ws = await self.swagger.events.eventWebsocket(app=apps)
    File "/usr/lib/python3.9/site-packages/asyncswagger11/client.py", line 110, in __call__
      ret = await self.http_client.ws_connect(uri, params=params,
    File "/usr/lib/python3.9/site-packages/asyncswagger11/http_client.py", line 237, in ws_connect
      ret = await create_websocket(url, headers=headers)
    File "/usr/lib/python3.9/site-packages/asyncwebsockets/client.py", line 59, in create_websocket
      ws = Websocket()
    File "/usr/lib/python3.9/site-packages/asyncwebsockets/websocket.py", line 30, in __init__
      self._send_lock = anyio.Lock()
  AttributeError: module 'anyio' has no attribute 'Lock'

Process finished with exit code 1

I see same error at ArchLinux python 9 and Centos7 python 3.6

asyncari installed by pip or by cloning this repo (same result).

smurfix commented 3 years ago

Yeah, there's some old not-anyio3-compatible code in there that needs to be modernized.

Pull Request welcome, otherwise I'll get to it sometime sooner or later.

Regela commented 3 years ago

I added pull-reguest, I am waiting for comments

Regela commented 3 years ago

Hello. Can we continue this task?

smurfix commented 3 years ago

Merged and pushed. Thank you, and sorry for the delay, $DAY_JOB takes up a lot of time at the moment.