Issue with loop on Windows platform (NotImplementedError)
- Ngôn ngữ chính
- Python
- Star
- 1.4k
- Fork
- 170
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
I have issue with connection to DB on Windows on code, which work on Linux.
After some research it looks like issue related to Windows what use SelectorEventLoop and it should be replaced to ProactorEventLoop. (check this [stackoverflow post](https://stackoverflow.com/a/44639711/3673470))
Traceback for my issue:
```
Traceback (most recent call last):
File "run_test.py", line 43, in
asyncio.run(Notifier(**data))
File "C:\Program Files\Python38\lib\asyncio\runners.py", line 43, in run
return loop.run_until_complete(main)
File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "C:\Users\X4\git\massenders\app\core\notifier.py", line 316, in ppr
clientManager: ClientManager = await ManagersDi.clientDataManager()
File "C:\Users\X4\git\massenders\app\core\di.py", line 56, in get_ClientManager
return ClientManager(await DBDi.mdbPool())
File "C:\Users\X4\git\massenders\app\core\di.py", line 30, in get_mdb_connection
return await aiopg.create_pool(mdb_dns, minsize=5, maxsize=30)
File "C:\Program Files\Python38\lib\site-packages\aiopg\pool.py", line 155, in from_pool_fill
await self._fill_free_pool(False)
File "C:\Program Files\Python38\lib\site-packages\aiopg\pool.py", line 193, in _fill_free_pool
conn = await connect(
File "C:\Program Files\Python38\lib\site-packages\aiopg\connection.py", line 38, in connect
coro = Connection(
File "C:\Program Files\Python38\lib\site-packages\aiopg\connection.py", line 92, in __init__
self._loop.add_reader(self._fileno, self._ready, self._weakref)
File "C:\Program Files\Python38\lib\asyncio\events.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
Exception ignored in:
Traceback (most recent call last):
File "C:\Program Files\Python38\lib\site-packages\aiopg\connection.py", line 512, in __del__
File "C:\Program Files\Python38\lib\site-packages\aiopg\connection.py", line 310, in close
File "C:\Program Files\Python38\lib\site-packages\aiopg\connection.py", line 285, in _close
File "C:\Program Files\Python38\lib\asyncio\events.py", line 504, in remove_reader
NotImplementedError:
```
The problem with `aiopg\connection.py` in `self._loop.add_reader(self._fileno, self._ready, self._weakref)` which referred to `asyncio\events.py` where all `class AbstractEventLoop` have `NotImplementedError`:
```
def add_reader(self, fd, callback, *args):
raise NotImplementedError
def remove_reader(self, fd):
raise NotImplementedError
```
and because there used direct methods (`self._loop.add_reader`) I can't make quick workaround to make code works. There need some implementation when Windows platform is used.
It is also referenced [in documentation](https://aiopg.readthedocs.io/en/stable/run_loop.html#rationale) note:
```
returns the running loop asyncio.AbstractEventLoop
```
Is it possible to add support of `asyncio.ProactorEventLoop()`?
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.