-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
The sample from the documentation does not seem to work with curio.
I get the following stacktrace:
**Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/anyio/_core/_eventloop.py", line 153, in get_asynclib
return sys.modules[modulename]
KeyError: 'anyio._backends._curio'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 3, in main
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1729, in get
return await self.request(
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1506, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1593, in send
response = await self._send_handling_auth(
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1621, in _send_handling_auth
response = await self._send_handling_redirects(
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1658, in _send_handling_redirects
response = await self._send_single_request(request)
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1695, in _send_single_request
response = await transport.handle_async_request(request)
File "/usr/local/lib/python3.8/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection_pool.py", line 216, in handle_async_request
status = RequestStatus(request)
File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection_pool.py", line 19, in __init__
self._connection_acquired = AsyncEvent()
File "/usr/local/lib/python3.8/site-packages/httpcore/_synchronization.py", line 29, in __init__
self._event = anyio.Event()
File "/usr/local/lib/python3.8/site-packages/anyio/_core/_synchronization.py", line 78, in __new__
return get_asynclib().Event()
File "/usr/local/lib/python3.8/site-packages/anyio/_core/_eventloop.py", line 155, in get_asynclib
return import_module(modulename)
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'anyio._backends._curio'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/anyio/_core/_eventloop.py", line 153, in get_asynclib
return sys.modules[modulename]
KeyError: 'anyio._backends._curio'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/site-packages/curio/kernel.py", line 822, in run
return kernel.run(corofunc, *args)
File "/usr/local/lib/python3.8/site-packages/curio/kernel.py", line 172, in run
raise ret_exc
File "/usr/local/lib/python3.8/site-packages/curio/kernel.py", line 736, in kernel_run
trap = current.send(current._trap_result)
File "/usr/local/lib/python3.8/site-packages/curio/task.py", line 167, in send
return self._send(value)
File "/usr/local/lib/python3.8/site-packages/curio/task.py", line 171, in _task_runner
return await coro
File "<stdin>", line 4, in main
File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1975, in __aexit__
await self._transport.__aexit__(exc_type, exc_value, traceback)
File "/usr/local/lib/python3.8/site-packages/httpx/_transports/default.py", line 332, in __aexit__
await self._pool.__aexit__(exc_type, exc_value, traceback)
File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection_pool.py", line 326, in __aexit__
await self.aclose()
File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection_pool.py", line 303, in aclose
async with self._pool_lock:
File "/usr/local/lib/python3.8/site-packages/httpcore/_synchronization.py", line 15, in __aenter__
await self._lock.acquire()
File "/usr/local/lib/python3.8/site-packages/anyio/_core/_synchronization.py", line 121, in acquire
await checkpoint_if_cancelled()
File "/usr/local/lib/python3.8/site-packages/anyio/lowlevel.py", line 42, in checkpoint_if_cancelled
await get_asynclib().checkpoint_if_cancelled()
File "/usr/local/lib/python3.8/site-packages/anyio/_core/_eventloop.py", line 155, in get_asynclib
return import_module(modulename)
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'anyio._backends._curio'
It might be because httpx use anyio which does not support curio anymore ?
Can httpx support curio without using anyio ?
Metadata
Metadata
Assignees
Labels
No labels