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' #4042

Closed
ahammond opened this issue Aug 15, 2016 · 6 comments
Closed

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

ahammond opened this issue Aug 15, 2016 · 6 comments

Comments

@ahammond
Copy link

ahammond commented Aug 15, 2016

Expected Behavior

Not crashing when inventory is full.

Actual Behavior

Traceback (most recent call last):
  File "pokecli.py", line 609, in <module>
    main()
  File "pokecli.py", line 104, in main
    bot.tick()
  File "/usr/src/app/pokemongo_bot/__init__.py", line 483, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/usr/src/app/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'
2016-08-15 16:06:56,623 [sentry.errors] [ERROR] Sentry responded with an error: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128) (url: https://app.getsentry.com/api/90254/store/)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/raven/transport/threaded.py", line 174, in send_sync
    super(ThreadedHTTPTransport, self).send(data, headers)
  File "/usr/local/lib/python2.7/site-packages/raven/transport/http.py", line 47, in send
    ca_certs=self.ca_certs,
  File "/usr/local/lib/python2.7/site-packages/raven/utils/http.py", line 66, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 494, in open
    response = self._open(req, data)
  File "/usr/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 512, in _open
    '_open', req)
  File "/usr/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 466, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python2.7/site-packages/raven/utils/http.py", line 46, in https_open
    return self.do_open(ValidHTTPSConnection, req)
  File "/usr/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 1284, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "/usr/local/lib/python2.7/httplib.py", line 1057, in request
    self._send_request(method, url, body, headers)
  File "/usr/local/lib/python2.7/httplib.py", line 1097, in _send_request
    self.endheaders(body)
  File "/usr/local/lib/python2.7/httplib.py", line 1053, in endheaders
    self._send_output(message_body)
  File "/usr/local/lib/python2.7/httplib.py", line 895, in _send_output
    msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128)
2016-08-15 16:06:56,631 [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']

Your config.json (remove your credentials and any other private info)

{
    "auth_service": "google",
    "username": "x",
    "password": "x",
    "gmapkey": "x",
    "libencrypt_location": "",
    "tasks": [
      {
        "type": "HandleSoftBan"
      },
      {
        "type": "SleepSchedule",
        "config": {
          "enabled": false,
          "time": "22:54",
          "duration":"7:46",
          "time_random_offset": "00:24",
          "duration_random_offset": "00:43"
        }
      },
      {
        "type": "CollectLevelUpReward"
      },
      {
        "type": "IncubateEggs",
        "config": {
          "longer_eggs_first": true
        }
      },
      {
        "type": "NicknamePokemon",
        "config": {
          "nickname_template": "{iv_pct}{name:.9s}"
        }
      },
      {
        "type": "UpdateLiveStats",
        "config": {
          "enabled": true,
          "min_interval": 10,
          "stats": ["uptime", "stardust_earned", "xp_earned", "xp_per_hour", "stops_visited"],
          "terminal_log": true,
          "terminal_title": true
        }
      },
      {
        "type": "TransferPokemon"
      },
      {
        "type": "EvolvePokemon",
        "config": {
            "evolve_all": ["Pidgey", "Rattata", "Zubat", "Sandshrew", "Vulpix", "Paras", "Venonat", "Diglett", "Meowth", "Mankey", "Growlithe", "Tentacool", "Doduo", "Seel", "Grimer", "Shellder", "Drowzee", "Krabby", "Voltorb", "Exeggcute", "Cubone", "Lickitung", "Koffing", "Tangela", "Omanyte", "Kabuto", "Munchlax"],
            "first_evolve_by": "iv",
            "evolve_above_cp": 1,
            "evolve_speed": 20,
            "use_lucky_egg": false
        }
      },
      {
        "type": "RecycleItems",
        "config": {
          "item_filter": {
            "Pokeball":       { "keep" : 100 },
            "Potion":         { "keep" : 0 },
            "Super Potion":   { "keep" : 0 },
            "Hyper Potion":   { "keep" : 20 },
            "Revive":         { "keep" : 20 },
            "Razz Berry":     { "keep" : 100 }
          }
        }
      },
      {
        "type": "SpinFort"
      },
      {
        "type": "CatchVisiblePokemon"
      },
      {
        "type": "CatchLuredPokemon"
      },
      {
        "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
    },
    "websocket_server": false,
    "walk": 4.56,
    "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": 10,
    "logging_color": true,
    "catch": {
      "any": {"catch_above_cp": 0,"catch_above_iv": 0,"logic": "and"}
    },
    "catch_throw_parameters": {
      "excellent_rate": 0.1,
      "great_rate": 0.4,
      "nice_rate": 0.4,
      "normal_rate": 0.1,
      "spin_success_rate" : 0.3
    },

    "release": {
      "Dragonite": { "never_release" : true },
      "Blastoise": { "never_release" : true },
      "Alakazam": { "never_release" : true },
      "Aerodactyl": { "never_release" : true },
      "Articuno": { "never_release" : true },
      "Zapdos": { "never_release" : true },
      "Moltres": { "never_release" : true },
      "Dragonair": { "never_release" : true },
      "Mew": { "never_release" : true },
      "Kabuto": { "never_release" : true },
      "Mewtwo": { "never_release" : true },
      "any": {"keep_best_cp": 1, "keep_best_iv": 1 }
    },
    "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": "and" },
        "Lapras": {},
        "Moltres": {},
        "Zapdos": {},
        "Articuno": {},

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

Steps to Reproduce

I have almost 300 ultraballs (hey, it'd be great to make more use of these!), I'm guessing this is the problem with the inventory.

Other Information

OS: docker
Git Commit:603aca6a0f1aa900a5b9c356445b2ab363a88fc6
Python Version: docker

@ahammond
Copy link
Author

Yup, reverting to the previous commit fixed this. @mjmadsen please take a look.

@Setsu-BHMT
Copy link

Duplicate #4021
If you take a look at the stack trace you'd see that it has nothing to do with your inventory.

@avexus
Copy link

avexus commented Aug 16, 2016

@ahammond how do you revert to previous commit?
I have the exact same problem

@mjmadsen
Copy link
Contributor

mjmadsen commented Aug 16, 2016

#4046 Looks like I missed a few references to self.bot.config.walk

Also, walk in the config has been replaced by walk_max and walk_min.

@avexus
Copy link

avexus commented Aug 16, 2016

2016-08-15 16:49:20,446 [ SpinFort] [INFO] [spun_pokestop] Spun pokestop Columbus Circle Postal Station. Experience awarded: 50. Items awarded: {u'Pokeball': 2, u'Max Potion': 1}
2016-08-15 16:49:22,447 [MoveToFort] [INFO] [inventory_full] Inventory is full. You might want to change your config to recycle more items if this message appears consistently.
2016-08-15 16:49:22,447 [FollowSpiral] [INFO] [position_update] Walking from (40.76949359248601, -73.98302911099192, 0) to (40.768874, -73.979419, 0) (311.727245876 m)
2016-08-15 16:49:24,194 [ cli] [INFO]
2016-08-15 16:49:24,194 [ cli] [INFO] Ran for 0:06:16
2016-08-15 16:49:24,194 [ cli] [INFO] Total XP Earned: 350 Average: 3352.00/h
2016-08-15 16:49:24,194 [ cli] [INFO] Travelled 0.16km
2016-08-15 16:49:24,194 [ cli] [INFO] Visited 7 stops
2016-08-15 16:49:24,194 [ cli] [INFO] Encountered 0 pokemon, 0 caught, 5 released, 0 evolved, 0 never seen before
2016-08-15 16:49:24,194 [ cli] [INFO] Threw 0 pokeballs
2016-08-15 16:49:24,194 [ cli] [INFO] Earned 0 Stardust
2016-08-15 16:49:24,194 [ cli] [INFO]
2016-08-15 16:49:24,194 [ cli] [INFO] Highest CP Pokemon:
2016-08-15 16:49:24,194 [ cli] [INFO] Most Perfect Pokemon:
Traceback (most recent call last):
File "pokecli.py", line 609, in
main()
File "pokecli.py", line 104, in main
bot.tick()
File "E:\downloads\PokemonGo-Bot\pokemongo_bot__init__.py", line 483, in tick
if worker.work() == WorkerResult.RUNNING:
File "E:\downloads\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'

@avexus
Copy link

avexus commented Aug 16, 2016

@Setsu-BHMT It crashes right after spun the pokestop, then the inventory was full, then crashed.

@k4n30 k4n30 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