PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

KeyError: 'candy'

Open Lunik opened this issue 10 years ago • 2 comments

Expected Behavior

Actual Behavior

Traceback (most recent call last):
  File "pokecli.py", line 470, in <module>
    main()
  File "pokecli.py", line 71, in main
    bot.tick()
  File "/home/lunik/pkm/pokemongo_bot/__init__.py", line 88, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/home/lunik/pkm/pokemongo_bot/cell_workers/transfer_pokemon.py", line 12, in work
    candies = get_candies(self.bot)
  File "/home/lunik/pkm/pokemongo_bot/cell_workers/utils.py", line 246, in get_candies
    candies[candy['family_id']] = candy['candy']
KeyError: 'candy'

Steps to Reproduce

Commit: fbda65e3f063b23b5eddee87f6b3338e66710a8b

Other Information

OS: Linux Git Commit: fbda65e3f063b23b5eddee87f6b3338e66710a8b Python Version: Python 2.9.7

Lunik avatar Aug 02 '16 18:08 Lunik

Expected Behavior Bot loads and runs. Actual Behavior Traceback (most recent call last): File "pokecli.py", line 470, in main() File "pokecli.py", line 71, in main bot.tick() File "/home/lunik/pkm/pokemongo_bot/init.py", line 88, in tick if worker.work() == WorkerResult.RUNNING: File "/home/lunik/pkm/pokemongo_bot/cell_workers/transfer_pokemon.py", line 12, in work candies = get_candies(self.bot) File "/home/lunik/pkm/pokemongo_bot/cell_workers/utils.py", line 246, in get_candies candies[candy['family_id']] = candy['candy'] KeyError: 'candy' Steps to Reproduce Commit: eac7989d41cca4ee0289304f5b4b903e9ca4b6f3 Other Information OS: Windows 10 Git Commit: eac7989d41cca4ee0289304f5b4b903e9ca4b6f3 Python Version: Python 2.7.10

ghost avatar Aug 02 '16 19:08 ghost

Some candy arrays are missing elements. Here's a temporary fix that works for me. Modify the if candy != {}: line of ./pokemongo_bot/cell_workers/utils.py (near the end of the file) to look like this: if candy != {} and 'family_id' in candy and 'candy' in candy:

Chaemelion avatar Aug 02 '16 19:08 Chaemelion