bdraco / aiodhcpwatcher

Watch for DHCP packets with asyncio
GNU General Public License v3.0
2 stars 1 forks source link

unfortunately I still can't get the example to run #20

Closed lejibxl closed 2 weeks ago

lejibxl commented 5 months ago

unfortunately I can't get your example to work

Python v 3.11.8 aiodhcpwatcher v 1.0.0

error

Traceback (most recent call last): File "dsc_dhcp.py", line 14, in asyncio.run(run()) File "C:\Python\Python311\Lib\asyncio\runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Python\Python311\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python\Python311\Lib\asyncio\base_events.py", line 654, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "D:\Works\micado\lib\dsc_dhcp.py", line 11, in run cancel = await aiodhcpwatcher.async_start(_async_process_dhcp_request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python\Python311\Lib\site-packages\aiodhcpwatcher__init.py", line 211, in async_start await watcher.async_start() File "C:\Python\Python311\Lib\site-packages\aiodhcpwatcher\init__.py", line 144, in async_start self._loop.add_reader( File "C:\Python\Python311\Lib\asyncio\events.py", line 534, in add_reader raise NotImplementedError NotImplementedError

bdraco commented 5 months ago

You need to change your event loop policy to selector on windows as protractor doesn't have add_reader

bdraco commented 5 months ago

if sys.platform == 'win32':
  asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

similar example https://github.com/saghul/aiodns#note-for-windows-users