Repository: PokemonGoF/PokemonGo-Bot

Issue:
[DEV]evolve all is not working
### Expected Behavior

In my config.json
I have set

"evolve_all": "Caterpie,Pidgey,Weedle,Zubat,Rattata",
"evolve_cp_min": 100,

Expected to evolve all the mentioned pokemon when I start the bot
### Actual Behavior

None of the mentioned pokemon is evolved
### Steps to Reproduce
### Other Information

OS: 
Git Commit: (run 'git log -n 1 --pretty=format:"%H"' and paste it here)

Corrupt files?
My bot stopped working all of a sudden.
After logging in successfully, this is the message I keep getting in my terminal

**Anyone has a clue?**

Traceback (most recent call last):
  File "pokecli.py", line 494, in <module>
    main()
  File "pokecli.py", line 62, in main
    bot.start()
  File "/Users/User1/PokemonGo-Bot/pokemongo_bot/**init**.py", line 54, in start
    self._setup_api()
  File "/Users/User1/PokemonGo-Bot/pokemongo_bot/__init__.py", line 289, in _setup_api
    self.update_inventory()
  File "/Users/User1/PokemonGo-Bot/pokemongo_bot/__init__.py", line 397, in update_inventory
    if {"item_id", "count"}.issubset(set(item_info.keys())):
AttributeError: 'NoneType' object has no attribute 'keys'
PokeBot crashed with exit code 1.  Respawning..

evolve_all "all" is not working
### Expected Behavior

Bot would try to evolve all eligible pokemon when "evolve_all": "all" is set
### Actual Behavior

Bot does not evolve anything when "evolve_all": "all" is set.  If I set it to "evolve_all": "all,Weedle" I get the following output: 

```
[19:11:08]  Starting PokemonGo Bot....
[19:11:09]  [x] Current egg hatches in 0.85 km
[19:11:10] [#] Successfully evolved Weedle with 180 CP and 0.4 IV!
[19:11:13] [#] Successfully evolved Weedle with 113 CP and 0.51 IV!
```
### Steps to Reproduce

Set "evolve_all" to all on this commit
### Other Information

OS: Ubuntu 14.04.4 LTS
Git Commit: eee7ba49c5c4e6bb1b3efefcf9f99a7c72a48671
Python Version: python 2.7.6

should_throttle_retry crash
Everything working fine, bot is walking then crashes to this. Happen multiple times so far.  Everything is up-to-date.

```
Traceback (most recent call last):
  File "pokecli.py", line 445, in <module>
    main()
  File "pokecli.py", line 71, in main
    bot.tick()
  File "C:\Trainers\PokemonGo-Bot01\pokemongo_bot\__init__.py", line 92, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "C:\Trainers\PokemonGo-Bot01\pokemongo_bot\cell_workers\incubate_eggs.py", line 41, in work
    self._apply_incubators()
  File "C:\Trainers\PokemonGo-Bot01\pokemongo_bot\cell_workers\incubate_eggs.py", line 52, in _apply_incubators
    pokemon_id=egg["id"]
  File "c:\pokemongo-bot\src\pgoapi\pgoapi\pgoapi.py", line 84, in function
    return request.call()
  File "C:\Trainers\PokemonGo-Bot01\pokemongo_bot\api_wrapper.py", line 112, in call
    if should_throttle_retry:
UnboundLocalError: local variable 'should_throttle_retry' referenced before assignment
```



Discussion:

Resolving patch:
diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py
--- a/pokemongo_bot/__init__.py
+++ b/pokemongo_bot/__init__.py
@@ -599,6 +599,7 @@ def _setup_api(self):
         # chain subrequests (methods) into one RPC call
 
         self._print_character_info()
+
         self.api.activate_signature("encrypt.so")
         self.logger.info('')
         self.update_inventory()
diff --git a/pokemongo_bot/cell_workers/handle_soft_ban.py b/pokemongo_bot/cell_workers/handle_soft_ban.py
--- a/pokemongo_bot/cell_workers/handle_soft_ban.py
+++ b/pokemongo_bot/cell_workers/handle_soft_ban.py
@@ -47,21 +47,24 @@ def work(self):
             )
 
     def spin_fort(self, fort):
+        fort_id = fort['id']
+        latitude = fort['latitude']
+        longitude = fort['longitude']
         self.bot.api.fort_search(
-            fort_id=fort['id'],
-            fort_latitude=fort['latitude'],
-            fort_longitude=fort['longitude'],
+            fort_id=fort_id,
+            fort_latitude=latitude,
+            fort_longitude=longitude,
             player_latitude=f2i(self.bot.position[0]),
             player_longitude=f2i(self.bot.position[1])
         )
-        self.bot.event_handler.emit(
+        self.emit_event(
             'spun_fort',
             level='debug',
             formatted="Spun fort {fort_id}",
             data={
                 'fort_id': fort_id,
-                'lat': fort['latitude'],
-                'lng': fort['longitude']
+                'latitude': latitude,
+                'longitude': longitude
             }
         )
 


Test patch: