When I run a python program, there is a warning message: "\Lib\site-packages\curl_cffi\aio.py:39: RuntimeWarning: Proactor event loop does not implement add_reader family of methods required. Registering an additional selector thread for add_reader support. To avoid this warning use: asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())
warnings.warn(PROACTOR_WARNING, RuntimeWarning)"
What is the meaning of this message? How could I avoid that?
I did issue the command "asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())" (as seen in the program listed below), but the same warning comes out. Regardless of the warning, the program seems execute correctly.
This error comes out when the statement "DDGS.text(..." was executed. I enclosed the program as follows:
import pandas as pd
from duckduckgo_search import DDGS
import asyncio
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
search_query = 'Python tutorials'
results = DDGS().text(
keywords=search_query,
region='wt-wt',
safesearch='off',
timelimit='7d',
max_results=50
)
print(results)
I've tried the statement "asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())", but same warnings still appear.
To avoid the warning about the Proactor event loop, set the event loop policy explicitly at the beginning of your script:
import asyncio
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
You can find more details about the issue on GitHub: click here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With