PokemonGoF / PokemonGo-Bot

The Pokemon Go Bot, baking with community.
MIT License
3.87k stars 1.54k forks source link

NameError: global name 'fort_details' is not defined #4528

Closed hobbes3 closed 8 years ago

hobbes3 commented 8 years ago

Expected Behavior

Bot should go to a fort/pokestop

Actual Behavior

Bot crashes

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

{
    "auth_service": "ptc",
    "username": "xxx",
    "password": "xxx",
    "location": "37.795614,-122.393536",
    "gmapkey": "xxx",
    "encrypt_location": "",
    "websocket_server": false,
    "heartbeat_threshold": 10,
    "tasks": [
    {
        "type": "HandleSoftBan"
    },
    {
        "type": "SleepSchedule",
        "config": {
        "enabled": false,
        "time": "09:04",
        "duration":"7:46",
        "time_random_offset": "00:24",
        "duration_random_offset": "00:43",
        "wake_up_at_location": "37.795614,-122.393536"
        }
    },
    {
        "type": "RandomPause",
        "config": {
        "enabled": false,
        "min_duration": "00:00:10",
        "max_duration": "00:10:00",
        "min_interval": "00:10:00",
        "max_interval": "02:00:00"
        }
    },
    {
        "type": "CompleteTutorial",
        "config": {
        "enabled": true,
        "// set a name": "",
        "nickname": "hobbes3k"
        }
    },
    {
        "type": "CollectLevelUpReward"
    },
    {
        "type": "IncubateEggs",
        "config": {
        "longer_eggs_first": true,
        "min_interval": 90
        }
    },
    {
        "type": "UpdateLiveStats",
        "config": {
        "enabled": true,
        "min_interval": 10,
        "stats": ["username", "uptime", "stardust_earned", "xp_earned", "xp_per_hour", "stops_visited"],
        "terminal_log": true,
        "terminal_title": true
        }
    },
    {
        "type": "UpdateLiveInventory",
        "config": {
        "enabled": true,
        "min_interval": 120,
        "show_all_multiple_lines": false,
        "items": ["pokemon_bag", "space_info", "pokeballs", "greatballs", "ultraballs", "razzberries", "luckyegg"]
        }
    },
    {
        "type": "TransferPokemon",
        "config": {
        "min_free_slot": 9999,
        "transfer_wait_min": 1,
        "transfer_wait_max": 4
        }
    },
    {
        "type": "NicknamePokemon",
        "config": {
        "enabled": false,
        "nickname_above_iv": 0.9,
        "nickname_template": "{iv_pct}_{iv_ads}"
        }
    },
    {
        "type": "EvolvePokemon",
        "config": {
        "evolve_all": "none",
        "__evolve_all": "Caterpie,Ekans,Goldeen,Krabby,Pidgey,Rattata,Paras,Spearow,Tentacool,Weedle,Zubat",
        "first_evolve_by": "iv",
        "evolve_above_cp": 0,
        "evolve_above_iv": 0,
        "logic": "or",
        "evolve_speed": 20,
        "use_lucky_egg": true
        }
    },
    {
        "type": "RecycleItems",
        "config": {
        "min_empty_space": 20,
        "max_balls_keep": 300,
        "max_potions_keep": 20,
        "max_berries_keep": 100,
        "max_revives_keep": 10,
        "item_filter": {
            "Pokeball":     { "keep" : 100 },
            "Greatball":    { "keep" : 100 },
            "Potion":       { "keep" : 0 },
            "Super Potion": { "keep" : 0 },
            "Hyper Potion": { "keep" : 0 },
            "Max Potion":   { "keep" : 20 },
            "Revive":       { "keep" : 0 },
            "Max Revive":   { "keep" : 10 },
            "Razz Berry":   { "keep" : 100 }
        },
        "recycle_wait_min": 1,
        "recycle_wait_max": 4
        }
    },
    {
        "type": "CatchPokemon",
        "config": {
        "catch_visible_pokemon": true,
        "catch_lured_pokemon": true,
        "min_ultraball_to_keep": 10,
        "berry_threshold": 0.35,
        "vip_berry_threshold": 0.9,
        "catch_throw_parameters": {
            "excellent_rate": 0.3,
            "great_rate": 0.5,
            "nice_rate": 0.2,
            "normal_rate": 0.1,
            "spin_success_rate" : 0.8,
            "hit_rate": 0.85
        },
        "catch_simulation": {
            "flee_count": 3,
            "flee_duration": 2,
            "catch_wait_min": 2,
            "catch_wait_max": 6,
            "berry_wait_min": 2,
            "berry_wait_max": 3,
            "changeball_wait_min": 2,
            "changeball_wait_max": 3
        }
        }
    },
    {
        "type": "SpinFort",
        "config": {
        "spin_wait_min": 1,
        "spin_wait_max": 3
        }
    },
    {
        "type": "MoveToFort",
        "config": {
        "lure_attraction": true,
        "lure_max_distance": 2000,
        "walker": "StepWalker"
        }
    },
    {
        "type": "FollowSpiral",
        "config": {
        "diameter": 0.1,
        "step_size": 30
        }
    }
    ],
    "map_object_cache_time": 5,
    "forts": {
    "avoid_circles": true,
    "max_circle_size": 50,
    "cache_recent_forts": true
    },
    "pokemon_bag": {
    "// if 'show_at_start' is true, it will log all the pokemons in the bag (not eggs) at bot start": {},
    "show_at_start": true,
    "// if 'show_count' is true, it will show the amount of each pokemon (minimum 1)": {},
    "show_count": false,
    "// if 'show_candies' is true, it will show the amount of candies for each pokemon": {},
    "show_candies": false,
    "// 'pokemon_info' parameter define which info to show for each pokemon": {},
    "// the available options are": {},
    "// ['cp', 'iv_ads', 'iv_pct', 'ivcp', 'ncp', 'level', 'hp', 'moveset', 'dps']": {},
    "pokemon_info": ["cp", "iv_pct"]
    },
    "walk_max": 8.16,
    "walk_min": 3.16,
    "alt_min": 500,
    "alt_max": 1000,
    "gps_default_altitude": 8.0,
    "replicate_gps_xy_noise": false,
    "replicate_gps_z_noise": false,
    "gps_xy_noise_range": 0.000125,
    "gps_z_noise_range": 12.5,
    "debug": false,
    "test": false,
    "health_record": true,
    "location_cache": true,
    "distance_unit": "km",
    "reconnecting_timeout": 15,
    "logging_color": true,
    "daily_catch_limit": 9999900,
    "catch": {
    "any": { "always_catch": true }
    },
    "catch_throw_parameters": {
    "excellent_rate": 0.2,
    "great_rate": 0.5,
    "nice_rate": 0.2,
    "normal_rate": 0.1,
    "spin_success_rate" : 0.8
    },
    "release": {
    "any": { "release_below_cp": 0, "release_below_iv": 0.9, "logic": "or" },

    "Articuno": { "release_below_cp": 0, "release_below_iv": 0, "logic": "or" },
    "Lapras":   { "release_below_cp": 0, "release_below_iv": 0, "logic": "or" },
    "Mew":      { "release_below_cp": 0, "release_below_iv": 0, "logic": "or" },
    "Mewtwo":   { "release_below_cp": 0, "release_below_iv": 0, "logic": "or" },
    "Moltres":  { "release_below_cp": 0, "release_below_iv": 0, "logic": "or" },
    "Snorlax":  { "release_below_cp": 0, "release_below_iv": 0, "logic": "or" },
    "Zapdos":   { "release_below_cp": 0, "release_below_iv": 0, "logic": "or" },

    "Magikarp": { "release_below_cp": 100, "release_below_iv": 9.5, "logic": "or" },

    "Caterpie":  { "keep_best_iv": 20 },
    "Goldeen":   { "keep_best_iv": 5 },
    "Krabby":    { "keep_best_iv": 5 },
    "Pidgey":    { "keep_best_iv": 60 },
    "Rattata":   { "keep_best_iv": 10 },
    "Spearow":   { "keep_best_iv": 10 },
    "Tentacool": { "keep_best_iv": 10 },
    "Weedle":    { "keep_best_iv": 20 },
    "Zubat":     { "keep_best_iv": 20 },

    "foo": "bar"
    },
    "vips" : {
        "Any pokemon put here directly force to use Berry & Best Ball to capture, to secure the capture rate!": {},
        "any": {"catch_above_cp": 500, "catch_above_iv": 0.9, "logic": "and" },
        "Abra": {},
        "Arcanine": {},
        "Articuno": {},
        "Bellsprout": {},
        "Blastoise": {},
        "Bulbasaur": {},
        "Charizard": {},
        "Charmander": {},
        "Charmeleon": {},
        "Dragonair": {},
        "Dragonite": {},
        "Dratini": {},
        "Eevee": {},
        "Exeggcute": {},
        "Exeggutor": {},
        "Flareon": {},
        "Growlithe": {},
        "Gyarados": {},
        "Ivysaur": {},
        "Kadabra": {},
        "Lapras": {},
        "Mew": {},
        "Mewtwo": {},
        "Moltres": {},
        "Snorlax": {},
        "Squirtle": {},
        "Vaporeon": {},
        "Venusaur": {},
        "Wartortle": {},
        "Zapdos": {},

        "foo": "bar"
    }
}

Output when issue occurred

016-08-22 05:16:09,133 [SleepSchedule] [INFO] [next_sleep] Next sleep at 2016-08-22 09:20:45.132905
2016-08-22 05:16:09,133 [RandomPause] [INFO] [next_random_pause] Next random pause at 05:48:12, for a duration of 0:04:54
2016-08-22 05:16:10,481 [PokemonGoBot] [INFO] [bot_start] Starting bot...
2016-08-22 05:16:11,810 [CollectLevelUpReward] [INFO] [level_up_reward] Received level up reward: []
2016-08-22 05:16:11,927 [IncubateEggs] [INFO] [next_egg_incubates] Eggs incubating: [4.40/5.0 km, 0.64/5.0 km] (Eggs left: 7, Incubating: 2)
2016-08-22 05:16:14,567 [UpdateLiveStats] [INFO] [log_stats] Hobbes3k | Uptime : 0:00:08 | Earned 0 Stardust | +0 XP | 0 XP/h | Visited 0 stops
2016-08-22 05:16:14,568 [UpdateLiveInventory] [INFO] [show_inventory] Pokemon: 183/650 | Items: 464/500 | Pokeballs: 60 | GreatBalls: 98 | UltraBalls: 142 | RazzBerries: 96 | LuckyEgg: 30
2016-08-22 05:16:14,687 [       cli] [INFO]
2016-08-22 05:16:14,687 [       cli] [INFO] Ran for 0:00:10
2016-08-22 05:16:14,688 [       cli] [INFO] Total XP Earned: 0  Average: 0.00/h
2016-08-22 05:16:14,688 [       cli] [INFO] Travelled 0.00km
2016-08-22 05:16:14,688 [       cli] [INFO] Visited 0 stops
2016-08-22 05:16:14,688 [       cli] [INFO] Encountered 0 pokemon, 0 caught, 0 released, 0 evolved, 0 never seen before
2016-08-22 05:16:14,689 [       cli] [INFO] Threw 0 pokeballs
2016-08-22 05:16:14,689 [       cli] [INFO] Earned 0 Stardust
2016-08-22 05:16:14,689 [       cli] [INFO] Hatched eggs 0
2016-08-22 05:16:14,689 [       cli] [INFO] Next egg hatches in 0.60 km
2016-08-22 05:16:14,689 [       cli] [INFO]
2016-08-22 05:16:14,689 [       cli] [INFO] Highest CP Pokemon:
2016-08-22 05:16:14,690 [       cli] [INFO] Most Perfect Pokemon:
Traceback (most recent call last):
File "pokecli.py", line 685, in <module>
    main()
File "pokecli.py", line 118, in main
    bot.tick()
File "/home/pokemon/PokemonGo-Bot/pokemongo_bot/__init__.py", line 565, in tick
    if worker.work() == WorkerResult.RUNNING:
File "/home/pokemon/PokemonGo-Bot/pokemongo_bot/cell_workers/catch_pokemon.py", line 29, in work
    pokemon += self.get_lured_pokemon()
File "/home/pokemon/PokemonGo-Bot/pokemongo_bot/cell_workers/catch_pokemon.py", line 91, in get_lured_pokemon
    details = fort_details(self.bot, fort_id=fort['id'],
NameError: global name 'fort_details' is not defined
2016-08-22 05:16:14,711 [sentry.errors] [ERROR] Sentry responded with an error: 'utf8' codec can't decode byte 0x9c in position 1: invalid start byte (url: https://app.getsentry.com/api/90254/store/)
Traceback (most recent call last):
File "/home/pokemon/.pyenv/versions/2.7.12/lib/python2.7/site-packages/raven/transport/threaded.py", line 174, in send_sync
    super(ThreadedHTTPTransport, self).send(data, headers)
File "/home/pokemon/.pyenv/versions/2.7.12/lib/python2.7/site-packages/raven/transport/http.py", line 47, in send
    ca_certs=self.ca_certs,
File "/home/pokemon/.pyenv/versions/2.7.12/lib/python2.7/site-packages/raven/utils/http.py", line 66, in urlopen
    return opener.open(url, data, timeout)
File "/home/pokemon/.pyenv/versions/2.7.12/lib/python2.7/site-packages/future/backports/urllib/request.py", line 494, in open
    response = self._open(req, data)
File "/home/pokemon/.pyenv/versions/2.7.12/lib/python2.7/site-packages/future/backports/urllib/request.py", line 512, in _open
    '_open', req)
File "/home/pokemon/.pyenv/versions/2.7.12/lib/python2.7/site-packages/future/backports/urllib/request.py", line 466, in _call_chain
    result = func(*args)
File "/home/pokemon/.pyenv/versions/2.7.12/lib/python2.7/site-packages/raven/utils/http.py", line 46, in https_open
    return self.do_open(ValidHTTPSConnection, req)
File "/home/pokemon/.pyenv/versions/2.7.12/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 "/home/pokemon/.pyenv/versions/2.7.12/lib/python2.7/httplib.py", line 1057, in request
    self._send_request(method, url, body, headers)
File "/home/pokemon/.pyenv/versions/2.7.12/lib/python2.7/httplib.py", line 1097, in _send_request
    self.endheaders(body)
File "/home/pokemon/.pyenv/versions/2.7.12/lib/python2.7/httplib.py", line 1053, in endheaders
    self._send_output(message_body)
File "/home/pokemon/.pyenv/versions/2.7.12/lib/python2.7/httplib.py", line 895, in _send_output
    msg += message_body
File "/home/pokemon/.pyenv/versions/2.7.12/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x9c in position 1: invalid start byte
2016-08-22 05:16:14,716 [sentry.errors.uncaught] [ERROR] [u"NameError: global name 'fort_details' is not defined", u'  File "pokecli.py", line 685, in <module>', u'  File "pokecli.py", line 118, in main', u'  File "pokemongo_bot/__init__.py", line 565, in tick', u'  File "pokemongo_bot/cell_workers/catch_pokemon.py", line 29, in work', u'  File "pokemongo_bot/cell_workers/catch_pokemon.py", line 91, in get_lured_pokemon']

Steps to Reproduce

Other Information

OS: Debian 8.1

Branch: dev Git Commit: 695ca70305be244a5c6fc12464d5242f14f648e7 Python Version: 2.7.12 Any other relevant files/configs (eg: path files)
mjmadsen commented 8 years ago

Doh. Let me put a PR out.

mjmadsen commented 8 years ago

1067e8c fixes this.

hobbes3 commented 8 years ago

Yup, it works now. Thanks!

mjmadsen commented 8 years ago

Awesome. Sorry about that!