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

AttributeError: 'Namespace' object has no attribute 'walk' #4077

Closed
foxmask opened this issue Aug 16, 2016 · 5 comments
Closed

AttributeError: 'Namespace' object has no attribute 'walk' #4077

foxmask opened this issue Aug 16, 2016 · 5 comments

Comments

@foxmask
Copy link

foxmask commented Aug 16, 2016

Expected Behavior

no crash

Actual Behavior

bot crashed

Your FULL config.json (remove your username, password, gmapkey and any other private info)

{
    "auth_service": "google",
    "username": "",
    "password": "",
    "location": "",
    "gmapkey": "",
    "encrypt_location": "",
    "websocket_server": false,
    "tasks": [
      {
        "type": "HandleSoftBan"
      },
      {
        "type": "SleepSchedule",
        "config": {
          "enabled": false,
          "time": "02:02",
          "duration":"5:21",
          "time_random_offset": "00:24",
          "duration_random_offset": "00:43"
        }
      },
      {
        "type": "CollectLevelUpReward"
      },
      {
        "type": "IncubateEggs",
        "config": {
          "longer_eggs_first": true
        }
      },
      {
        "type": "TransferPokemon"
      },
      {
        "type": "EvolvePokemon",
        "config": {
            "evolve_all": "none",
            "first_evolve_by": "cp",
            "evolve_above_cp": 500,
            "evolve_above_iv": 0.8,
            "logic": "or",
            "evolve_speed": 20,
            "use_lucky_egg": false
        }
      },
      {
        "type": "RecycleItems",
        "config": {
          "min_empty_space": 6, 
          "max_balls_keep": 150,
          "max_potions_keep": 50,
          "max_berries_keep": 70,
          "max_revives_keep": 70,
          "item_filter": {
            "Pokeball":       {"keep": 80},
            "Greatball":      {"keep": 60},
            "Ultraball":      {"keep": 60},
            "Masterball":     {"keep": 100},
            "Potion":         {"keep": 20},
            "Super Potion":   {"keep": 30},
            "Hyper Potion":   {"keep": 30},
            "Max Potion":     {"keep": 50},
            "Revive":         {"keep": 30},
            "Max Revive":     {"keep": 30},
            "Razz Berry":     {"keep": 30}
          }
        }
      },
      {
        "type": "CatchVisiblePokemon"
      },
      {
        "type": "CatchLuredPokemon"
      },
      {
        "type": "SpinFort"
      },
      {
        "type": "MoveToFort",
        "config": {
            "lure_attraction": true,
            "lure_max_distance": 2000
        }
      },
      {
        "type": "FollowSpiral",
        "config": {
          "diameter": 4,
          "step_size": 70
        }
      }
    ],
    "map_object_cache_time": 5,
    "forts": {
      "avoid_circles": true,
      "max_circle_size": 50,
      "cache_recent_forts": true
    },
    "walk_max": 4.16,
    "walk_min": 2.16,
    "action_wait_min": 1,
    "action_wait_max": 4,
    "debug": false,
    "test": false,
    "health_record": true,
    "location_cache": true,
    "distance_unit": "km",
    "reconnecting_timeout": 15,
    "catch_randomize_reticle_factor": 1.0,
    "catch_randomize_spin_factor": 1.0,
    "min_ultraball_to_keep": 50,
    "logging_color": true,
    "catch": {
      "any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"},
      "// Example of always catching Rattata:": {},
      "// Rattata": { "always_catch" : true }
    },
    "catch_throw_parameters": {
      "excellent_rate": 0.1,
      "great_rate": 0.5,
      "nice_rate": 0.3,
      "normal_rate": 0.1,
      "spin_success_rate" : 0.6
    },
    "release": {
      "any": {"release_below_cp": 0, "release_below_iv": 0, "logic": "or"},
      "// Example of always releasing Rattata:": {},
      "// Rattata": {"always_release": true},
      "// Example of keeping 3 stronger (based on CP) Pidgey:": {},
      "// Pidgey": {"keep_best_cp": 3},
      "// Example of keeping 2 stronger (based on IV) Zubat:": {},
      "// Zubat": {"keep_best_iv": 2},
      "// Also, it is working with any": {},
      "// any": {"keep_best_iv": 3},
      "// Example of keeping the 2 strongest (based on CP) and 3 best (based on IV) Zubat:": {},
      "// Zubat": {"keep_best_cp": 2, "keep_best_iv": 3}
    },
    "vips" : {
         "Any pokemon put here directly force to use Berry & Best Ball to capture, to secure the capture rate!": {},
        "any": {"catch_above_cp": 1200, "catch_above_iv": 0.9, "logic": "or" },
        "Lapras": {},
        "Moltres": {},
        "Zapdos": {},
        "Articuno": {},

        "// S-Tier pokemons (if pokemon can be evolved into tier, list the representative)": {},
        "Mewtwo": {},
        "Dragonite": {},
        "Snorlax": {},
        "// Mew evolves to Mewtwo": {},
        "Mew": {},
        "Arcanine": {},
        "Vaporeon": {},
        "Gyarados": {},
        "Exeggutor": {},
        "Muk": {},
        "Weezing": {},
        "Flareon": {}

    }
}

Output when issue occurred

Hi,
since the last "release", "walk" is deprecated and replaced by "walk_min" or "walk_max"

But it may happened (I did not know how follow spiral is triggered), the following behavior :

Traceback (most recent call last):
  File "pokecli.py", line 609, in <module>
    main()
  File "pokecli.py", line 104, in main
    bot.tick()
  File "/home/foxmask/PokemonGo-Bot/pokemongo_bot/__init__.py", line 483, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/home/foxmask/PokemonGo-Bot/pokemongo_bot/cell_workers/follow_spiral.py", line 117, in work
    if dist <= 1 or (self.bot.config.walk > 0 and step_walker == None):
AttributeError: 'Namespace' object has no attribute 'walk'

    [...]

    UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128)
 [sentry.errors.uncaught] [ERROR] [u"AttributeError: 'Namespace' object has no attribute 'walk'", u'  File "pokecli.py", line 609, in <module>', u'  File "pokecli.py", line 104, in main', u'  File "pokemongo_bot/__init__.py", line 483, in tick', u'  File "pokemongo_bot/cell_workers/follow_spiral.py", line 117, in work']

I made a test by replacing on line 117 :

    self.bot.config.walk 

by

    self.bot.config.walk_min

and there seems to not crashing anymore, but I dont know what is the expected behavior here, if it should be self.bot.config.walk_min or self.bot.config.walk_max

Steps to Reproduce

I did not find the moment when the follow sprital is triggered

Other Information

OS:linux

Branch: master

Git Commit: 52495ae

Python Version:
Python 2.7.9

@simonsmh
Copy link
Contributor

git checkout dev

@foxmask
Copy link
Author

foxmask commented Aug 16, 2016

You got it :)

@k4n30
Copy link
Contributor

k4n30 commented Aug 16, 2016

Merge request created for those who don't want to switch to dev branch. Wait for the green Open box to change to a purple Merged box and then update

@BriceSD
Copy link
Contributor

BriceSD commented Aug 16, 2016

Fixed here #4046

@BriceSD BriceSD closed this as completed Aug 16, 2016
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
@foxmask @k4n30 @BriceSD @simonsmh and others