ImportError: cannot import name 'search' from 'googlesearch' in python

145 Views Asked by At

When I am importing google from googlesearch I am getting the following error.

from googlesearch import search

(...\AppData\Roaming\Python\Python39\site-packages\googlesearch\__init__.py)
ImportError: cannot import name 'search' from 'googlesearch' in python

I simply tried to run the entire googlesearch.py code from "...\appdata\roaming\python\python39\site-packages\googlesearch\googlesearch.py". However, then I got the following error.

totalText = soup.select(GoogleSearch.TOTAL_SELECTOR)[0].children.__next__()

IndexError: list index out of range

Does anyone know how to fix this issue?

1

There are 1 best solutions below

0
elebur On

It seems that you've confused these two libraries googlesearch-python and google-search.

Most likely you've installed the second one but trying to use API from the first one.