PokeAPI / pokepy

A Python wrapper for PokéAPI
https://pokeapi.co
BSD 3-Clause "New" or "Revised" License
127 stars 27 forks source link

An error has occurred. #72

Closed dongsu8142 closed 3 years ago

dongsu8142 commented 3 years ago

If you use this in Heroku, it will cause an error.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'PokemonResource' object is not subscriptable
Naramsim commented 3 years ago

Can you post a simple example of code that triggers that error?

dongsu8142 commented 3 years ago

https://github.com/hands8142/manyy_api/blob/938499ce8492cff3046a18bd1ba6d3b0d231c653/main.py#L206

I'm turning this around to Heroku. There is no error when I turn it to my local computer, but when I turn it to Heroku, an error occurs.

Kronopt commented 3 years ago

Can you specify both your environments? Your local environment and heroku. Like, OS, python version, pokepy version, etc

Kronopt commented 3 years ago

Ah, I see your problem:

poke = client.get_pokemon(pokename)[0]

should be

poke = client.get_pokemon(pokename)

hence the "not subscriptable" error. You're probably using an older version of pokepy on heroku