Comments (5)
Thanks for the report, I don't think this is an issue with this library as I can reproduce the same issue just using httpx.
import asyncio
from httpx import AsyncClient
async def main():
client = AsyncClient()
try:
while True:
await asyncio.sleep(10)
except (KeyboardInterrupt, asyncio.CancelledError):
response = await client.get('https://example.com')
print(response)
asyncio.run(main())
You may find more information in the httpx repo, https://github.com/encode/httpx.
from prisma-client-py.
That example works just fine for me [email protected]
. Are you sure the issue isn't with this library @RobertCraigie ?
This is the error message btw.
^C | ExceptionGroup: multiple connection attempts failed (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/anyio/_core/_sockets.py", line 168, in try_connect
| stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2202, in connect_tcp
| await get_running_loop().create_connection(
| File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/asyncio/base_events.py", line 1099, in create_connection
| raise exceptions[0]
| File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/asyncio/base_events.py", line 1081, in create_connection
| sock = await self._connect_sock(
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/asyncio/base_events.py", line 984, in _connect_sock
| await self.sock_connect(sock, address)
| File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/asyncio/selector_events.py", line 647, in sock_connect
| return await fut
| ^^^^^^^^^
| File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/asyncio/selector_events.py", line 687, in _sock_connect_cb
| raise OSError(err, f'Connect call failed {address}')
| ConnectionRefusedError: [Errno 61] Connect call failed ('::1', 54727, 0, 0)
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/anyio/_core/_sockets.py", line 168, in try_connect
| stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2202, in connect_tcp
| await get_running_loop().create_connection(
| File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/asyncio/base_events.py", line 1099, in create_connection
| raise exceptions[0]
| File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/asyncio/base_events.py", line 1081, in create_connection
| sock = await self._connect_sock(
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/asyncio/base_events.py", line 984, in _connect_sock
| await self.sock_connect(sock, address)
| File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/asyncio/selector_events.py", line 647, in sock_connect
| return await fut
| ^^^^^^^^^
| File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/asyncio/selector_events.py", line 687, in _sock_connect_cb
| raise OSError(err, f'Connect call failed {address}')
| ConnectionRefusedError: [Errno 61] Connect call failed ('127.0.0.1', 54727)
+------------------------------------
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 114, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/anyio/_core/_sockets.py", line 230, in connect_tcp
raise OSError("All connection attempts failed") from cause
OSError: All connection attempts failed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
yield
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request
raise exc
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
response = await connection.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpcore/_async/connection.py", line 92, in handle_async_request
raise exc
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpcore/_async/connection.py", line 69, in handle_async_request
stream = await self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpcore/_async/connection.py", line 117, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
return await self._backend.connect_tcp(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 112, in connect_tcp
with map_exceptions(exc_map):
File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/contextlib.py", line 155, in __exit__
self.gen.throw(value)
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: All connection attempts failed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/nix/Projects/nix/news-hunter/wip.py", line 18, in <module>
asyncio.run(main())
File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/asyncio/base_events.py", line 664, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/wip.py", line 14, in main
await db.log.find_many()
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/prisma/actions.py", line 3572, in find_many
resp = await self._client._execute(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/prisma/client.py", line 507, in _execute
return await self._engine.query(builder.build(), tx_id=self._tx_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/prisma/engine/query.py", line 244, in query
return await self.request(
^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/prisma/engine/http.py", line 119, in request
resp = await self.session.request(method, url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/prisma/_async_http.py", line 28, in request
return Response(await self.session.request(method, url, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1617, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpx/_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 352, in handle_async_request
with map_httpcore_exceptions():
File "/Users/nix/.pyenv/versions/3.12.0/lib/python3.12/contextlib.py", line 155, in __exit__
self.gen.throw(value)
File "/Users/nix/Projects/nix/news-hunter/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: All connection attempts failed
from prisma-client-py.
@NixBiks hmm, I get this error using httpx==0.25.0
and httpcore==0.18.0
with my httpx only script.
^CTraceback (most recent call last):
File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/foo.py", line 13, in main
response = await client.get('https://example.com')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/httpx/_client.py", line 1757, in get
return await self.request(
^^^^^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/httpx/_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/httpx/_client.py", line 1617, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/httpx/_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/httpx/_transports/default.py", line 366, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request
raise exc
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
response = await connection.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request
stream = await self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/httpcore/_async/connection.py", line 124, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
return await self._backend.connect_tcp(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 114, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/anyio/_core/_sockets.py", line 221, in connect_tcp
await event.wait()
File "/Users/robert/code/prisma-client-py/.direnv/python-3.11.4/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 1778, in wait
if await self._event.wait():
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/locks.py", line 213, in wait
await fut
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/robert/code/prisma-client-py/foo.py", line 17, in <module>
asyncio.run(main())
File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 123, in run
raise KeyboardInterrupt()
KeyboardInterrupt
from prisma-client-py.
Super odd! And we are both on macOS it seems. Are you running in a virtual environment? I'm running in a clean virtual environment
╭─ ~/Projects/nix/test ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ✘ INT 3.11.4 at 11:27:52
╰─❯ poetry show --tree
httpcore 0.18.0 A minimal low-level HTTP client.
├── anyio >=3.0,<5.0
│ ├── idna >=2.8
│ └── sniffio >=1.1
├── certifi *
├── h11 >=0.13,<0.15
└── sniffio ==1.*
httpx 0.25.0 The next generation HTTP client.
├── certifi *
├── httpcore >=0.18.0,<0.19.0
│ ├── anyio >=3.0,<5.0
│ │ ├── idna >=2.8
│ │ └── sniffio >=1.1
│ ├── certifi *
│ ├── h11 >=0.13,<0.15
│ └── sniffio ==1.* (circular dependency aborted here)
├── idna *
└── sniffio *
╭─ ~/Projects/nix/test ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ✘ INT 3.11.4 at 11:25:34
╰─❯ poetry run python --version
Python 3.11.4
╭─ ~/Projects/nix/test ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 3.11.4 at 11:25:07
╰─❯ poetry run python wip.py
^C<Response [200 OK]>
@RobertCraigie not entirely convinced that this should be closed.
from prisma-client-py.
@RobertCraigie just tried with another laptop. Same result
from prisma-client-py.
Related Issues (20)
- Consistent enum formatting in 3.11+
- Provide a TypedDict for every model
- Drop support for Python 3.7
- Option to generate camelcase python methods/function names. HOT 1
- Retrying db calls?
- Option --generator not being honoured HOT 2
- Pydantic >2.0 makes `prisma generate` crash HOT 2
- Allow specifying generated package name and location HOT 1
- How to import enum values by prisma-client-py ? HOT 1
- Support schemas that are using the preview feature relationJoins on different generators HOT 1
- Generate Async and Sync client together at the same time HOT 2
- httpx.ConnectError: All connection attempts failed HOT 1
- Once event loop is closed, async client can not be used anymore. HOT 2
- Support accessing the DMMF at runtime HOT 1
- P1011: Error opening a TLS connection: bad protocol version
- Upgrading version from 0.11.0 to 0.12.0 in Elastic Beanstalk fails deployment HOT 1
- Avoid writing to `site-packages/prisma` HOT 1
- When generator client output is set, `prisma db push` fails with Permission Denied
- Is there a way to override use_enum_values?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prisma-client-py.