Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'AsyncLock' object has no attribute '_anyio_lock' #2890

Closed
T-256 opened this issue Oct 12, 2023 · 1 comment
Closed

AttributeError: 'AsyncLock' object has no attribute '_anyio_lock' #2890

T-256 opened this issue Oct 12, 2023 · 1 comment

Comments

@T-256
Copy link
Contributor

T-256 commented Oct 12, 2023

Try install httpx + httpcore 1.0 then remove anyio. Error:

(.venv) E:\hcore1>python app.py
Traceback (most recent call last):
  File "E:\hcore1\app.py", line 6, in main
    r = await client.get('https://www.example.com/')
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1757, in get
    return await self.request(
           ^^^^^^^^^^^^^^^^^^^
  File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1530, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1617, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1645, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1682, in _send_handling_redirects
    response = await self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 1719, in _send_single_request
    response = await transport.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\hcore1\.venv\Lib\site-packages\httpx\_transports\default.py", line 366, in handle_async_request
    resp = await self._pool.handle_async_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\hcore1\.venv\Lib\site-packages\httpcore\_async\connection_pool.py", line 224, in handle_async_request
    async with self._pool_lock:
  File "E:\hcore1\.venv\Lib\site-packages\httpcore\_synchronization.py", line 62, in __aenter__
    self.setup()
  File "E:\hcore1\.venv\Lib\site-packages\httpcore\_synchronization.py", line 55, in setup
    raise RuntimeError(
RuntimeError: Running with asyncio requires installation of 'httpcore[asyncio]'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\hcore1\app.py", line 8, in <module>
    asyncio.run(main())
  File "C:\Users\Tester\.rye\py\cpython@3.12.0\install\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\Tester\.rye\py\cpython@3.12.0\install\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Tester\.rye\py\cpython@3.12.0\install\Lib\asyncio\base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "E:\hcore1\app.py", line 5, in main
    async with httpx.AsyncClient() as client:
  File "E:\hcore1\.venv\Lib\site-packages\httpx\_client.py", line 2003, in __aexit__
    await self._transport.__aexit__(exc_type, exc_value, traceback)
  File "E:\hcore1\.venv\Lib\site-packages\httpx\_transports\default.py", line 345, in __aexit__
    await self._pool.__aexit__(exc_type, exc_value, traceback)
  File "E:\hcore1\.venv\Lib\site-packages\httpcore\_async\connection_pool.py", line 327, in __aexit__
    await self.aclose()
  File "E:\hcore1\.venv\Lib\site-packages\httpcore\_async\connection_pool.py", line 312, in aclose
    async with self._pool_lock:
  File "E:\hcore1\.venv\Lib\site-packages\httpcore\_synchronization.py", line 67, in __aenter__
    await self._anyio_lock.acquire()
          ^^^^^^^^^^^^^^^^
AttributeError: 'AsyncLock' object has no attribute '_anyio_lock'

(.venv) E:\hcore1>

Originally posted by @T-256 in #2885 (comment)

@T-256
Copy link
Contributor Author

T-256 commented Oct 12, 2023

That is httpcore issue.

@T-256 T-256 closed this as completed Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant