Skip to content

Instantly share code, notes, and snippets.

@kspviswa
Last active February 11, 2024 02:51
Show Gist options
  • Save kspviswa/6efe09b937af61315cec2f585eea60f5 to your computer and use it in GitHub Desktop.
Save kspviswa/6efe09b937af61315cec2f585eea60f5 to your computer and use it in GitHub Desktop.
Gist explaining the issue with v4.4.1 of duckduckgo_search
import threading
from duckduckgo_search import DDGS
def do_Search():
with DDGS() as ddgs:
searchResults = [r for r in ddgs.text('What is duckduckgo?', max_results=5)]
print(searchResults)
def main():
x = threading.Thread(target=do_Search) # -> Issue reproduced if not running main thread
x.start()
x.join()
# do_Search(). --> Uncomment this line and comment line #10-12 if running is main thread
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment