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

[BUG] Calling an object not instatiated after #4333

Open BriceSD opened this issue 10 years ago • 2 comments

Config

      "type": "MoveToMapPokemon",
      "config": {
        "address": "http://localhost:5000",
        "max_distance": 500,
        "min_ball": 20,
        "prioritize_vips": true,
        "snipe": true,
        "snipe_high_prio_only": true,
        "snipe_high_prio_threshold": 400,
        "update_map": true,
        "mode": "priority",
        "map_path": "raw_data",
        "walker": "StepWalker",
        "max_extra_dist_fort": 10,
        …

Seems like #4333 made appear a bug. Apparently step_walker = self._move_to_pokemon_througt_fort(nearest_fort, pokemon) doesn’t always return a StepWalker, causing the error when calling it later if not step_walker.step(): See line 297 of move_to_map_pokemon.py

step_walker = self._move_to_pokemon_througt_fort(nearest_fort, pokemon)
if not step_walker.step():

Output when issue occurred

Traceback (most recent call last):
  File "pokecli.py", line 677, in <module>
    main()
  File "pokecli.py", line 118, in main
    bot.tick()
  File "/home/brice/Code/PokemonGo-Bot/pokemongo_bot/__init__.py", line 561, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/home/brice/Code/PokemonGo-Bot/pokemongo_bot/cell_workers/move_to_map_pokemon.py", line 297, in work
    if not step_walker.step():
AttributeError: 'NoneType' object has no attribute 'step'
l

Steps to Reproduce

Use MoveToMapPokemon

Other Information

OS: Archlinux Branch: dev Git Commit: c4d651c59cbf6a5ad9a629bc129002a7c798db24 Python Version: Python 2.7.12

BriceSD avatar Aug 21 '16 22:08 BriceSD

I guess the return at line 440 should not be inside the if

EDIT

I guess when it reaches the fort (when it doesn't go inside that if) it should spin the fort and return a StepWalker to the pokemon or any location, since it will be recalculated.

DeXtroTip avatar Aug 21 '16 23:08 DeXtroTip

Merged the fix.

mjmadsen avatar Aug 22 '16 05:08 mjmadsen