eclipse / paho.mqtt.python

paho.mqtt.python
Other
2.12k stars 722 forks source link

AttributeError: module 'trio' has no attribute 'MultiError' #811

Closed FilipeMarch closed 4 months ago

FilipeMarch commented 4 months ago

Bug Description

main.py

import asks, trio

async def get_google():
    response = await asks.get("https://google.com")
    print(response)

trio.run(get_google)

Executing python main.py results in the following error:

Traceback (most recent call last):
File ".venv/lib/python3.11/site-packages/anyio/_core/_eventloop.py", line 151, in get_asynclib
return sys.modules[modulename]
~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'anyio._backends._trio'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 9, in <module>
trio.run(get_google)
File ".venv/lib/python3.11/site-packages/trio/_core/_run.py", line 2275, in run
raise runner.main_task_outcome.error
File "main.py", line 5, in get_google
response = await asks.get("https://google.com")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.11/site-packages/asks/base_funcs.py", line 30, in request
r = await s.request(method, url=uri, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.11/site-packages/asks/sessions.py", line 198, in request
async with self.sema:
File ".venv/lib/python3.11/site-packages/anyio/_core/_synchronization.py", line 300, in __aenter__
await self.acquire()
File ".venv/lib/python3.11/site-packages/anyio/_core/_synchronization.py", line 313, in acquire
await checkpoint_if_cancelled()
File ".venv/lib/python3.11/site-packages/anyio/lowlevel.py", line 45, in checkpoint_if_cancelled
await get_asynclib().checkpoint_if_cancelled()
^^^^^^^^^^^^^^
File ".venv/lib/python3.11/site-packages/anyio/_core/_eventloop.py", line 153, in get_asynclib
return import_module(modulename)
^^^^^^^^^^^^^^^^^^^^^^^^^
File ".pyenv/versions/3.11.6/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File ".venv/lib/python3.11/site-packages/anyio/_backends/_trio.py", line 162, in <module>
class ExceptionGroup(BaseExceptionGroup, trio.MultiError):
^^^^^^^^^^^^^^^
File ".venv/lib/python3.11/site-packages/trio/_deprecate.py", line 153, in __getattr__
raise AttributeError(msg.format(self.__name__, name))
AttributeError: module 'trio' has no attribute 'MultiError'

Reproduction

python main.py

Environment

PierreF commented 4 months ago

This bug is not unrelated to this project.

FilipeMarch commented 4 months ago

sorry it seems I clicked on the wrong browser tab lol