paho.mqtt.python
paho.mqtt.python copied to clipboard
raise error when run the examples loop_asyncio.py
Hi, when run the examples loop_asyncio.py with paho-mqt 2.1.0 will raise NotImplementedError.
BTW, I test it on win11 with python3.10.
Ran into the same issue. For me the error was due to asyncio defaulting to ProactorEventLoop, which on Windows does not support the loop.add_reader() and loop.add_writer() methods used in the loop_asyncio.py example.
I was able to get the example working by putting the line
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
before the call to asyncio.get_event_loop() as suggested in this pyzmq issue.