Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command raised an exception: AttributeError: module 'search_google' has no attribute 'api' #4

Open
codeofandrin opened this issue Jan 3, 2021 · 1 comment
Labels

Comments

@codeofandrin
Copy link

codeofandrin commented Jan 3, 2021

Hi there

I just started using the module search-google 1.2.1 and I have a problem.
First, I used the module in a python file without any other librarys except of json and search-google
Everything worked. After that I put the code into a command at the library discord.py
And then when I want to use search-google this error occure:

Ignoring exception in command googlesearch:
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "F:\DiscordBot\PyCharm\Google\Commands\google_search.py", line 54, in googlesearch
    results = search_google.api.results(buildargs, cseargs)
AttributeError: module 'search_google' has no attribute 'api'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 859, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'search_google' has no attribute 'api'

My code: https://mystb.in/WorldcatBloggerTokyo.python

@rrwen
Copy link
Owner

rrwen commented Oct 18, 2021

@Puncher1 Have you tried reinstalling the package?

It looks like it did not find api.py in the package - maybe it was altered somehow or deleted.

You can also try importing api directly:

from search_google import api

results = api.results(...)

@rrwen rrwen added the question label Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants