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

UnboundLocalError: local variable 'bot' referenced before assignment

Open TechDaddyKB opened this issue 10 years ago • 2 comments

Expected Behavior

Bot Startup

Actual Behavior

pokebot@helva:/opt/PokemonGo-Bot$ ./run.sh configs/config.madmanx007.json 2016-08-07 00:20:15,161 [ cli] [INFO] PokemonGO Bot v1.0 Traceback (most recent call last): File "pokecli.py", line 493, in main() File "pokecli.py", line 126, in main if bot: UnboundLocalError: local variable 'bot' referenced before assignment

Steps to Reproduce

executing pokecli.py -cf configs/config.madmanx007.json or run.sh configs/config.madmanx007.json

Other Information

OS: Ubuntu Trusty Git Commit: c21fad0e476a2ab77e8ec6eb898c03b1c3dbf3dd Python Version: Python 2.7.12

Custom Config File

{ "auth_service": "ptc", "username": "madmanx007", "password": "REMOVED", "location": "41.601388, -93.528259", "gmapkey": "REMOVED", "tasks": [ { "type": "HandleSoftBan" }, { "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": { "item_filter": { "Potion": { "keep": 20 }, "Super Potion": { "keep": 20 }, "Hyper Potion": { "keep": 20 }, "Revive": { "keep": 20 }, "Razz Berry": { "keep": 50 } } } }, { "type": "CatchVisiblePokemon" }, { "type": "CatchLuredPokemon" }, { "type": "SpinFort" }, { "type": "FollowPath", "config": { "path_mode": "loop", "path_file": "configs/path.CopperCreek_PleasantHillIA.json" } }, { "type": "FollowSpiral", "config": { "diameter": 4, "step_size": 70 } } ], "map_object_cache_time": 5, "forts": { "avoid_circles": true, "max_circle_size": 50 }, "websocket_server": false, "walk": 4.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, "evolve_captured": "NONE", "catch_randomize_reticle_factor": 1, "catch_randomize_spin_factor": 1, "catch": { "any": { "catch_above_cp": 0, "catch_above_iv": 0 } }, "release": { "any": { "keep_best_iv": 2, "keep_best_cp": 2 } }, "vips": { "any": { "catch_above_cp": 1200, "catch_above_iv": 0.9, "logic": "or" }, "Lapras": {}, "Moltres": {}, "Zapdos": {}, "Articuno": {}, "Mewtwo": {}, "Dragonite": {}, "Snorlax": {}, "Mew": {}, "Arcanine": {}, "Vaporeon": {}, "Gyarados": {}, "Exeggutor": {}, "Muk": {}, "Weezing": {}, "Flareon": {} } }

TechDaddyKB avatar Aug 07 '16 04:08 TechDaddyKB

Json error. stoopid comma

TechDaddyKB avatar Aug 07 '16 04:08 TechDaddyKB

i've the exactly the same bug error message:

2016-08-07 17:18:28,039 [       cli] [INFO] PokemonGO Bot v1.0
2016-08-07 17:18:28,040 [       cli] [INFO] No config argument specified, checking for /configs/config.json
2016-08-07 17:18:28,041 [       cli] [INFO] Configuration initialized
2016-08-07 17:18:28,041 [pokemongo_bot.health_record.bot_event] [INFO] Health check is enabled. For more logrmation:
2016-08-07 17:18:28,041 [pokemongo_bot.health_record.bot_event] [INFO] https://github.com/PokemonGoF/PokemonGo-Bot/tree/dev#analytics
2016-08-07 17:18:28,047 [requests.packages.urllib3.connectionpool] [INFO] Starting new HTTP connection (1): www.google-analytics.com
Traceback (most recent call last):
  File "pokecli.py", line 493, in <module>
    main()
  File "pokecli.py", line 126, in main
    if bot:
UnboundLocalError: local variable 'bot' referenced before assignment
2016-08-07 17:18:28,092 [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 "/Users/alex/Dropbox/projects/PokemonGo-Bot/lib/python2.7/site-packages/raven/transport/threaded.py", line 174, in send_sync
    super(ThreadedHTTPTransport, self).send(data, headers)
  File "/Users/alex/Dropbox/projects/PokemonGo-Bot/lib/python2.7/site-packages/raven/transport/http.py", line 47, in send
    ca_certs=self.ca_certs,
  File "/Users/alex/Dropbox/projects/PokemonGo-Bot/lib/python2.7/site-packages/raven/utils/http.py", line 66, in urlopen
    return opener.open(url, data, timeout)
  File "/Users/alex/Dropbox/projects/PokemonGo-Bot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 494, in open
    response = self._open(req, data)
  File "/Users/alex/Dropbox/projects/PokemonGo-Bot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 512, in _open
    '_open', req)
  File "/Users/alex/Dropbox/projects/PokemonGo-Bot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 466, in _call_chain
    result = func(*args)
  File "/Users/alex/Dropbox/projects/PokemonGo-Bot/lib/python2.7/site-packages/raven/utils/http.py", line 46, in https_open
    return self.do_open(ValidHTTPSConnection, req)
  File "/Users/alex/Dropbox/projects/PokemonGo-Bot/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/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1057, in request
    self._send_request(method, url, body, headers)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1097, in _send_request
    self.endheaders(body)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1053, in endheaders
    self._send_output(message_body)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/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-07 17:18:28,093 [sentry.errors.uncaught] [ERROR] [u"UnboundLocalError: local variable 'bot' referenced before assignment", u'  File "pokecli.py", line 493, in <module>', u'  File "pokecli.py", line 126, in main']

my config:

{
    "auth_service": "google",
    "username": "xxxx",
    "password": "xxxxxxx",
    "location": "xxxxxxxxx",
    "gmapkey": "xxxxxxxx",
    "tasks": [
      {
        "type": "HandleSoftBan"
      },
      {
        "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": {
          "item_filter": {
            "Pokeball":       { "keep" : 100 },
            "Potion":         { "keep" : 10 },
            "Super Potion":   { "keep" : 20 },
            "Hyper Potion":   { "keep" : 30 },
            "Revive":         { "keep" : 30 },
            "Razz Berry":     { "keep" : 100 }
          }
        }
      },
      {
        "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
    },
    "websocket_server": false,
    "walk": 4.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,
    "evolve_captured": "NONE",
    "catch_randomize_reticle_factor": 1.0,
    "catch_randomize_spin_factor": 1.0,

    "catch": {
      "any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"}
    },
    "release": {
      "Eevee": {"keep_best_iv": 20},
      "Weedle": {"keep_best_iv": 50},
      "Rattata": {"keep_best_iv": 50},
      "Golbat": {"keep_best_iv": 1},
      "Kakuna": {"keep_best_iv": 1},
      "Pidgeot": {"keep_best_iv": 1},
      "Pidgeotto": {"keep_best_iv": 1},
      "Pidgey": {"keep_best_iv": 50},
      "Zubat": {"keep_best_iv": 50},
      "Raticate": {"keep_best_iv": 1},
      "any": {"keep_best_iv": 3}
    },
    "vips" : {
      "any": {"catch_above_cp": 1200, "catch_above_iv": 0.9, "logic": "or" },

      "Lapras": {},
      "Moltres": {},
      "Zapdos": {},
      "Articuno": {},

      "Mewtwo": {},
      "Dragonite": {},
      "Snorlax": {},
      "Mew": {},
      "Arcanine": {},
      "Vaporeon": {},
      "Gyarados": {},
      "Exeggutor": {},
      "Muk": {},
      "Weezing": {},
      "Pikachu": {},
      "Flareon": {}
    }
}

commit: dc0f3864f9a4f689d30e24c03b13807515a89669 how did you find missing coma?

DmitryStolyarow avatar Aug 07 '16 05:08 DmitryStolyarow