Closed jasonoh1998 closed 3 months ago
How can I reproduce this problem?
I use curl_cffi==0.6.0b7 and it runs OK
@desaiankitb I've made the changes, try the latest version v5.2.2
@deedy5
I actually should have added that I was using langchain sorry to miss that. The package works fine overall, just saw some warning so wanted to flag it.
You can reproduce this issue by using things below. I actually get different warning message now using 5.2.2.
langchain
and duckduckgo-search
packages using pip.
pip install langchain duckduckgo-search
Run the following Python script:
from langchain_community.tools.ddg_search.tool import DuckDuckGoSearchResults
ddg_search = DuckDuckGoSearchResults()
query = "how much calories does a banana have"
results = ddg_search.run(query)
print(results)
When running the script, the following warning is issued:
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())
@desaiankitb
Thanks for the clarification.
I have committed the patch.
Try installing it from git and check it out.
pip install git+https://github.com/deedy5/duckduckgo_search.git
The warning message is no longer appearing. Thank you!
I am also getting this warning. I just ran pip install -U duckduckgo_search
to update it. Did I need to do something else? (I know it successfully updated because it wasn't working at all before the update)
my code
with DDGS() as ddgs:
try:
results = [r for r in ddgs.text("Download ODBC Driver for SQL Server", max_results=1)]
print(results)
QDesktopServices.openUrl(QUrl(results[0]['href']))
print('Opened URL')
except Exception as e:
print('Failed with error:', e)
QDesktopServices.openUrl(QUrl(default_url))
Hello,
Everything is working great for me after the update, but I'm encountering a warning related to curl_cffi in a python application that utilizes asynchronous operations to perform searches using the DuckDuckGoSearchResults class.
Environment:
Warning Message:
Warning Code Snippet:
Additional Observations:
I noticed that this warning started appearing after updating
duckduckgo-search
from version 5.1.0 to versions 5.2~5.2.1. The classAsyncDDGS
implementation had some changes during these updates. No such warning was observed while using version 5.1.0.Thank you!