bisohns / search-engine-parser

Lightweight package to query popular search engines and scrape for result titles, links and descriptions
https://search-engine-parser.readthedocs.io
459 stars 87 forks source link

RuntimeError: There is no current event loop in thread 'MainThread'. #152

Closed andreacortis closed 2 years ago

andreacortis commented 3 years ago

Describe the bug RuntimeError: There is no current event loop in thread 'MainThread'.

To Reproduce UBUNTU 20.04 -- pipenv

╰─(googlebooks-rNF90ExY) ⠠⠵ ipython
Python 3.8.10 (default, Sep 28 2021, 16:10:42) Type 'copyright', 'credits' or 'license' for more information IPython 7.30.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from search_engine_parser.core.engines.google import Search ...: searcher = Search() ...: results = searcher.search("Tallest mountain in the world")

RuntimeError Traceback (most recent call last)

in 1 from search_engine_parser.core.engines.google import Search 2 searcher = Search() ----> 3 results = searcher.search("Tallest mountain in the world") ~/.local/share/virtualenvs/googlebooks-rNF90ExY/lib/python3.8/site-packages/search_engine_parser/core/base.py in search(self, query, page, cache, proxy, proxy_auth, **kwargs) 279 page = 1 280 # Get search Page Results --> 281 loop = asyncio.get_event_loop() 282 url = self.get_search_url( 283 query, page, **kwargs) /usr/lib/python3.8/asyncio/events.py in get_event_loop(self) 637 638 if self._local._loop is None: --> 639 raise RuntimeError('There is no current event loop in thread %r.' 640 % threading.current_thread().name) 641 RuntimeError: There is no current event loop in thread 'MainThread'.
judemont commented 1 year ago

I have the same issue...