Python’s `google` Module

So, like me, you become interested in the possibility of executing Google searches from within a Python script, and, like me, you installed the google module — which some have noted is no longer developed by Google itself but by a third party — and got an import error, here is what happened: yes, you did install it as google:

pip install google

but you do not call it google because that will lead to an ImportError. Instead, the name of the module is googlesearch, so what you want to do is this:

from googlesearch import search

Now it works.

Hat tip to shylajhaa sathyaram in his comment on GeeksforGeeks.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.