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

List index out of range #4

Open
kotaruTWK opened this issue Oct 9, 2022 · 2 comments
Open

List index out of range #4

kotaruTWK opened this issue Oct 9, 2022 · 2 comments
Labels

Comments

@kotaruTWK
Copy link

I cant seem to figure out the exact reason it occurs but some search terms result in a "list index out of range".
im using this with a discord bot and so far everything is working except for a few random searches like searching safebooru for "rem" or rule34 for "princess_rosalina". (Both of these searches work on the actual site itself.
exact error:
`[2022-10-08 20:08:46] [ERROR ] discord.client: Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python310\lib\site-packages\booru\client\safebooru.py", line 139, in search
return better_object(self.not_random[randint(0, len(self.not_random))])
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 409, in _run_event
await coro(*args, **kwargs)
File "C:\Users\xxxxx\Downloads\Python programs\waifu.py", line 109, in on_message
res = await imgs.search(query=content, random=True, gacha=True)
File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python310\lib\site-packages\booru\client\safebooru.py", line 148, in search
raise ValueError(f"Failed to get data: {e}")
ValueError: Failed to get data: list index out of range`

  • OS: windows 11
  • Python: 3.10.7
@da-vinci-bot
Copy link

da-vinci-bot bot commented Oct 9, 2022

Hey! @kotaruTWK You'll get a response soon! UwU


Click here to make your day UmU
abc

@da-vinci-bot da-vinci-bot bot added the triage label Oct 9, 2022
@sinkaroid
Copy link
Owner

Trying to update booru to 1.0.21 and give limit= property with 10-50.

Safebooru response "rem" with 100 is empty here: https://safebooru.org/index.php?page=dapi&s=post&q=index&tags=rem&limit=100&pid=1&json=1

You can validate the proper tags instead rem with: booru.client.safebooru.Safebooru.find_tags

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