Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: walker_factory() takes at least 5 arguments (4 given) #4253

Closed
p1n9 opened this issue Aug 19, 2016 · 11 comments
Closed

TypeError: walker_factory() takes at least 5 arguments (4 given) #4253

p1n9 opened this issue Aug 19, 2016 · 11 comments

Comments

@p1n9
Copy link

p1n9 commented Aug 19, 2016

Expected Behavior

Running fine with move to map pokemon enabled in conf

Actual Behavior

Crash just after starting or few minutes later...
It seems that the update map position is working but each time it try to move to one pokemon it crash just after.

FULL config.json

http://pastebin.com/sEvBJsuR

Output when issue occurred

Traceback (most recent call last):
  File "pokecli.py", line 611, in <module>
    main()
  File "pokecli.py", line 105, in main
    bot.tick()
  File "/var/www/html/PokemonGo-Bot/pokemongo_bot/__init__.py", line 532, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/var/www/html/PokemonGo-Bot/pokemongo_bot/cell_workers/move_to_map_pokemon.py", line 279, in work
    step_walker = self._move_to(pokemon)
  File "/var/www/html/PokemonGo-Bot/pokemongo_bot/cell_workers/move_to_map_pokemon.py", line 383, in _move_to
    **{'parent': MoveToMapPokemon}
TypeError: walker_factory() takes at least 5 arguments (4 given)

Steps to Reproduce

Running bot with move to map pokemon enabled

Other Information

OS: ubuntu 14.04
Branch: dev
Git Commit: 324b752
Python Version: Python 2.7.6

@mvrska
Copy link
Contributor

mvrska commented Aug 19, 2016

speed argument is not being passed to walker_factory. It should not even be passed there since speed was determined by StepWalker itself from self.speed = uniform(self.bot.config.walk_min, self.bot.config.walk_max)

someone fiddling with walker without testing? :)

@mvrska
Copy link
Contributor

mvrska commented Aug 19, 2016

even StepWalker doesnt take 5 arguments

@mvrska
Copy link
Contributor

mvrska commented Aug 19, 2016

you can temporarily fix this by disabling the polyline worker in walker_factory.py

replace the contents of walker_factory.py with

from pokemongo_bot.walkers.polyline_walker import PolylineWalker
from pokemongo_bot.walkers.step_walker import StepWalker

def walker_factory(name, bot, dest_lat, dest_lng, *args, **kwargs):
    '''
    Charlie and the Walker Factory
    '''
    if 'StepWalker' == name:
        ret = StepWalker(bot, dest_lat, dest_lng)
    # elif 'PolylineWalker' == name:
    #     try:
    #         ret = PolylineWalker(bot, speed, dest_lat, dest_lng, *args, **kwargs)
    #     except:
    #         ret = StepWalker(bot, dest_lat, dest_lng)
    return ret

@hlavicka
Copy link

hlavicka commented Aug 19, 2016

@Raiven66 it helped but then crashed again

Traceback (most recent call last):
  File "C:\PokemonGo-Bot\pokecli.py", line 611, in <module>
    main()
  File "C:\PokemonGo-Bot\pokecli.py", line 105, in main
    bot.tick()
  File "C:\PokemonGo-Bot\pokemongo_bot\__init__.py", line 532, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "C:\PokemonGo-Bot\pokemongo_bot\cell_workers\move_to_map_pokemon.py", line 279, in work
    step_walker = self._move_to(pokemon)
  File "C:\PokemonGo-Bot\pokemongo_bot\cell_workers\move_to_map_pokemon.py", line 383, in _move_to
    **{'parent': MoveToMapPokemon}
  File "C:\PokemonGo-Bot\pokemongo_bot\walkers\walker_factory.py", line 9, in walker_factory
    ret = StepWalker(bot, speed, dest_lat, dest_lng)
NameError: global name 'speed' is not defined

my bad. I forgot to remove the speed from the other place

@p1n9
Copy link
Author

p1n9 commented Aug 19, 2016

@Raiven66 your temp fix works for now, no more crash for me. Thanks =)
but MoveToMapPokemon task doesn't run, "move to" or "update location" are not displayed in log anymore
ok it has taken a long time before the task start running (?!), now it's working

@mvrska
Copy link
Contributor

mvrska commented Aug 19, 2016

@hlavicka can you just copypaste the whole thing and not just choose the lines you wish? :P
the fix works

@mvrska
Copy link
Contributor

mvrska commented Aug 19, 2016

@p1n9 make sure you have the config in good shape

@p1n9
Copy link
Author

p1n9 commented Aug 19, 2016

Fix is here #4254

@k4n30
Copy link
Contributor

k4n30 commented Aug 19, 2016

@p1n9 please leave open until merged

@p1n9
Copy link
Author

p1n9 commented Aug 19, 2016

@k4n30 Ok, I will close after the merge (sorry)

@mjmadsen
Copy link
Contributor

Should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants