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

Update the location & location_cache logic #1217

Merged
merged 1 commit into from
Jul 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,11 @@ def _set_starting_position(self):
logger.log('GeoPosition: {}'.format(self.position))
logger.log('')
has_position = True
return
except:
logger.log('[x] The location given using -l could not be parsed. Checking for a cached location.')
pass

if self.config.location_cache and not has_position:
if self.config.location_cache:
try:
#
# save location flag used to pull the last known location from
Expand All @@ -438,7 +437,7 @@ def _set_starting_position(self):
location_json = json.load(f)
location = (location_json['lat'],
location_json['lng'], 0.0)
print(location)
#print(location)
self.api.set_position(*location)

logger.log('')
Expand All @@ -452,8 +451,11 @@ def _set_starting_position(self):
has_position = True
return
except:
sys.exit(
"No cached Location. Please specify initial location.")
if(has_position == False):
sys.exit(
"No cached Location. Please specify initial location.")
logger.log('[x] Parsing cached location failed, try to use the initial location...')
pass

def _get_pos_by_name(self, location_name):
# Check if the given location is already a coordinate.
Expand Down