Error with looking up pokemon
Closed this issue · 6 comments
This error occured kind of out of the blue. I don't quite know what might have caused it.
I already tried deleting the cache, updating, uninstalling and reinstalling the package but nothing really helped.
Here are a few examples of the error. I used to console to make sure it's nothing else that might have an effect on it:
Type "help", "copyright", "credits" or "license" for more information.
>>> import pokebase as pb
>>> charmander = pb.pokemon('charmander')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Kjell Hoffhenke\AppData\Local\Programs\Python\Python36\lib\site-packages\pokebase\loaders.py", line 483, in pokemon
return NamedAPIResource('pokemon', id_or_name)
File "C:\Users\Kjell Hoffhenke\AppData\Local\Programs\Python\Python36\lib\site-packages\pokebase\api.py", line 311, in __init__
n = APIResourceList(r).id_to_name(name)
File "C:\Users\Kjell Hoffhenke\AppData\Local\Programs\Python\Python36\lib\site-packages\pokebase\api.py", line 433, in id_to_name
.format(id_))
ValueError: resource not found (charmander), check spelling
>>> charmander = pb.pokemon(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Kjell Hoffhenke\AppData\Local\Programs\Python\Python36\lib\site-packages\pokebase\loaders.py", line 483, in pokemon
return NamedAPIResource('pokemon', id_or_name)
File "C:\Users\Kjell Hoffhenke\AppData\Local\Programs\Python\Python36\lib\site-packages\pokebase\api.py", line 319, in __init__
self.load()
File "C:\Users\Kjell Hoffhenke\AppData\Local\Programs\Python\Python36\lib\site-packages\pokebase\api.py", line 359, in load
self.__data['name']))
File "C:\Users\Kjell Hoffhenke\AppData\Local\Programs\Python\Python36\lib\site-packages\pokebase\api.py", line 159, in lookup_data
r.raise_for_status()
File "C:\Users\Kjell Hoffhenke\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\models.py", line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: NOT FOUND for url: https://pokeapi.co/api/v2/pokemon/stench/
>>> p = pb.NamedAPIResource("pokemon", 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Kjell Hoffhenke\AppData\Local\Programs\Python\Python36\lib\site-packages\pokebase\api.py", line 319, in __init__
self.load()
File "C:\Users\Kjell Hoffhenke\AppData\Local\Programs\Python\Python36\lib\site-packages\pokebase\api.py", line 359, in load
self.__data['name']))
File "C:\Users\Kjell Hoffhenke\AppData\Local\Programs\Python\Python36\lib\site-packages\pokebase\api.py", line 159, in lookup_data
r.raise_for_status()
File "C:\Users\Kjell Hoffhenke\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\models.py", line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: NOT FOUND for url: https://pokeapi.co/api/v2/pokemon/stench/```
For me at least it seems to be some kind of error with the id and name converter
edit: slight formatting fix
Am I really the only one facing this issue?
I experience it both on my PC and my completly independent server :(
And it brakes everything
Today was the first chance I had to run my code - sorry for the delay.
Unfortunately, I am unable to reproduce this error. Everything seems to be working fine on my end.
Here's a few things I would suggest (although I imagine you've already tried all these, I'm saying them to be safe in case something was overlooked):
- Does the API work for you, just in the browser?
- Are you running this wrapper in a virtualenv or not? Try the opposite. (Though you did say it doesn't work on an independent server, so I highly doubt this would affect it)
- Maybe others are having the same problem but haven't come here. Ask around in the PokeAPI Slack help channel.
I'm sorry I can't offer much more than that to help :(
- In Browser it works just fine
- On my Server it's in a virtualenv on my PC it isn't
- Will ask around :/
alright so just out of despair I have deleted the cache folder once more and it somehow appears to have fixed it. Doing the same on the server helped aswell.
Idk what caused it but it somehow did so on both at the same time, which appears really weird to me at least
It's weird to me too, you're not the only one.
But Yay! I'm glad its working for you. I wish I could tell you what went wrong, but I can't.
I'm gonna close, but if any new information comes to light, feel free to comment and/or reopen.
This happened to me when I was starting up because I had an out-of-date libopenssl
which was causing the connection to pokeapi.co to fail. I suspect intermittent network issues could do the same thing; perhaps that was @AtomToast was seeing.