arnavb/pypokedex

ValueError when following example from PyPi

Closed this issue · 2 comments

Tried code:

import pypokedex

p = pypokedex.get(dex=445)

Received this error:

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    p = pypokedex.get(dex=445)
  File "/Users/ashwinnair/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/pypokedex/api.py", line 43, in get
    return Pokemon(response.json())
  File "/Users/ashwinnair/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/pypokedex/pokemon.py", line 117, in __init__
    ] = Pokemon._extract_sprites(sprites)
  File "/Users/ashwinnair/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/pypokedex/pokemon.py", line 134, in _extract_sprites
    sprite_direction, sprite_type = sprite.split("_", 1)
ValueError: not enough values to unpack (expected 2, got 1)

Am I doing something wrong?

Looks like a recent PR in PokeAPI (PokeAPI/pokeapi#521) added support for animated sprites which I don't currently handle. I'll look into getting a bugfix for this out ASAP.

Alright, thanks :)