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

AttributeError: 'PokemonGoBot' object has no attribute 'position'

Open ghost opened this issue 10 years ago • 5 comments

Expected Behavior

Bot runs

Actual Behavior

[2016-07-30 17:53:40] [x] PokemonGO Bot v1.0 [2016-07-30 17:53:40] [x] Configuration initialized [2016-07-30 17:53:40] [x] The location given using -l could not be parsed. Checking for a cached location. [2016-07-30 17:53:44] [#] x [2016-07-30 17:53:44] [#] x [2016-07-30 17:53:45] [#] x [2016-07-30 17:53:46] [#] x [2016-07-30 17:53:46] [#] x [2016-07-30 17:53:46] [#] x [2016-07-30 17:53:46] [#] x [2016-07-30 17:53:46] [#] x [2016-07-30 17:53:46] [#] x [2016-07-30 17:53:46] [#] x [2016-07-30 17:53:46] [#] x [2016-07-30 17:53:46] [#] x [2016-07-30 17:53:46] [#] x [2016-07-30 17:53:46] [#] x [2016-07-30 17:53:46] [#] Traceback (most recent call last): File "pokecli.py", line 220, in main() File "pokecli.py", line 206, in main bot.start() File "/usr/src/app/pokemongo_bot/init.py", line 32, in start self.stepper = Stepper(self) File "/usr/src/app/pokemongo_bot/stepper.py", line 32, in init self.origin_lat = self.bot.position[0] AttributeError: 'PokemonGoBot' object has no attribute 'position'

My Configuration

{ "auth_service": "google", "username": "x", "password": "x", "location": "40.762723, 14.025207", "gmapkey": "xxx", "max_steps": 5, "mode": "all", "walk": 10, "catch_pokemon": true, "debug": false, "test": false, "initial_transfer": 0, "location_cache": true, "distance_unit": "km", "item_filter": "101,102,103,104", "evolve_all": "NONE", "softban_fix": true }

Steps to Reproduce

Running it on my server.

Other Information

OS: Arch Linux // GNOME 3 Git Commit: 55390cfd7fcedace99c2c3d372b3790ef5b7cfd7

ghost avatar Jul 30 '16 18:07 ghost

changing "location": "40.762723, 14.025207", to "location": "40.762723,14.025207", (removing the space) might fix this

mrthrowaway avatar Jul 30 '16 19:07 mrthrowaway

I have the same error with the latest master branch .

0z4ck avatar Jul 30 '16 21:07 0z4ck

The error is inpokemongo_bot/__init__.py. The code to parse a lat/lon is incorrectly hard set to 6/7 decimal places, bombing if you have any less or more. The below code changes it to 4-7 places, which if you search for a location in Google, it reports only 4 significant figures of decimal degrees. In reality, it should be set to any number with an optional decimal.

diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py
index 6dc13bb..f5eb002 100644
--- a/pokemongo_bot/__init__.py
+++ b/pokemongo_bot/__init__.py
@@ -333,7 +333,7 @@ class PokemonGoBot(object):
     def _get_pos_by_name(self, location_name):
         # Check if the given location is already a coordinate.
         if ',' in location_name:
-            possibleCoordinates = re.findall("[-]?\d{1,3}[.]\d{6,7}", location_name)
+            possibleCoordinates = re.findall("[-]?\d{1,3}[.]\d{4,7}", location_name)
             if len(possibleCoordinates) == 2:
                 # 2 matches, this must be a coordinate. We'll bypass the Google geocode so we keep the exact location.
                 logger.log(

Acuchillar avatar Jul 31 '16 01:07 Acuchillar

go to the slack chatroom then in #help someone will help you setup the bot correctly closed: NOT A BUG

gregtampa avatar Jul 31 '16 07:07 gregtampa

@gregtampa, I disagree. There is no requirement that lat/lons have any specific number of decimal degrees, which the regexp requires. There are no comments or documentation that state this 6/7 decimal degrees requirement, and Google returns 4 decimal places which means you will have many reported bugs with this.

It should match with or without decimal degrees with no requirement of min/max, and, in addition, bug #1854 means that this input and regexp should be changed to allow altitude anyway. Please reconsider this bugs status.

Recommend a fix for an embedded json for location which has: location name, and lat/lon/altitude, documenting which one is prioritized.

Acuchillar avatar Jul 31 '16 14:07 Acuchillar