Comments (4)
Ah I see.
Can you try to apply the following diff:
diff --git a/psycopg3/psycopg3/waiting.py b/psycopg3/psycopg3/waiting.py
index bfab413..e607024 100644
--- a/psycopg3/psycopg3/waiting.py
+++ b/psycopg3/psycopg3/waiting.py
@@ -196,13 +196,6 @@ async def wait_conn_async(gen: PQGenConn[RV]) -> RV:
return rv
-poll_evmasks = {
- Wait.R: select.EPOLLONESHOT | select.EPOLLIN,
- Wait.W: select.EPOLLONESHOT | select.EPOLLOUT,
- Wait.RW: select.EPOLLONESHOT | select.EPOLLIN | select.EPOLLOUT,
-}
-
-
def wait_epoll(
gen: PQGen[RV], fileno: int, timeout: Optional[float] = None
) -> RV:
@@ -247,5 +240,12 @@ if (
is selectors.EpollSelector
):
wait = wait_epoll
+
+ poll_evmasks = {
+ Wait.R: select.EPOLLONESHOT | select.EPOLLIN,
+ Wait.W: select.EPOLLONESHOT | select.EPOLLOUT,
+ Wait.RW: select.EPOLLONESHOT | select.EPOLLIN | select.EPOLLOUT,
+ }
+
else:
wait = wait_selector
If it work I'll commit it to master
from psycopg.
I have applied the diff to master. Please let us know if it fixes your problem. There might be others as macOS is untested
from psycopg.
The error changed. Now it is:
File "/Users/jacopo/projects/pgtest/.venv/lib/python3.9/site-packages/psycopg3/waiting.py", line 240, in <module>
is getattr(selectors, 'EpollSelector')
AttributeError: module 'selectors' has no attribute 'EpollSelector'
On my system dir(selector)
shows these attributes:
'ABCMeta', 'BaseSelector', 'DefaultSelector', 'EVENT_READ', 'EVENT_WRITE', 'KqueueSelector', 'Mapping', 'PollSelector', 'SelectSelector', 'SelectorKey', '_BaseSelectorImpl', '_PollLikeSelector', '_SelectorMapping', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_can_use', '_fileobj_to_fd', 'abstractmethod', 'math', 'namedtuple', 'select', 'sys'
It seems epoll is available only on Linux, but if I change the code to getattr(selectors, 'EpollSelector', None)
in the check then it falls back to wait_selector
and I can run the example code without problems.
from psycopg.
Thank you, good to know. I will make this changeset too in master.
from psycopg.
Related Issues (20)
- Review error swallowing in cancel methods
- Add timeout (with a sensible default) to cancel_safe HOT 2
- Bad decoding of connection cancel error message HOT 2
- Allow sending updated timeout to notifies generator HOT 2
- Segmentation Fault on mac HOT 1
- Suggestion: Replace SELECT 1 with an empty query HOT 2
- Detecting disconnection documentation
- excecute with str argument? HOT 4
- Copy data as fast as possible with a job in the cloud (Big query and Cloud SQL)
- Suggestion: scalar_row to type check at runtime HOT 1
- RuntimeWarning: coroutine 'AsyncCursor.execute' was never awaited HOT 7
- couldn't import psycopg 'c' implementation: No module named 'psycopg_c' HOT 6
- What am I missing regarding ConnectionPool max_lifetime and FastAPI HOT 6
- v = connection.exec_driver_sql("select pg_catalog.version()").scalar() returning bytestring instead of str on Azure Postgres with psycopg>3 and sqlalchemy2 HOT 5
- psycopg-binary SHA256 mismatch HOT 6
- enhancement: Support for pgbouncer SHOW STATS (disabling Extended Query Protocol) HOT 2
- Document how to connect to pgbouncer HOT 1
- Add instructions to build documentation from source HOT 3
- malloc: double free for ptr 0x1243fd200 HOT 4
- Django 4 - ProgrammingError the last operation didn't produce a result HOT 2
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 psycopg.