python
system_error
ai_generated
true
RuntimeError: add_reader() is not supported on Windows
ID: python/asyncio-loop-add-reader
80%Fix Rate
85%Confidence
0Evidence
2024-09-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.7 | active | — | — | — |
| 3.8 | active | — | — | — |
Root Cause
Using asyncio.add_reader() or add_writer() on Windows, which uses ProactorEventLoop by default.
generic中文
在Windows上使用asyncio.add_reader()或add_writer(),因为Windows默认使用ProactorEventLoop。
Workarounds
-
90% success
reader, writer = await asyncio.open_connection(host, port)
-
95% success
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
Dead Ends
Common approaches that don't work:
-
90% fail
Same issue; the loop type is still Proactor.
-
30% fail
Works but may have other limitations on Windows.