Skip to content

Commit

Permalink
Fix UnicodeEncodeError causing location not found (#1054)
Browse files Browse the repository at this point in the history
When there are special characters in initial location, e.g. "ç" a UnicodeEncodeError is raised and caught causing valid initial locations being reported as not parsable.
  • Loading branch information
João Vieira authored and douglascamata committed Jul 26, 2016
1 parent 7aaf345 commit 014401d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,11 @@ def _set_starting_position(self):

if self.config.location:
try:
location_str = u'{}'.format(str(self.config.location))
location_str = self.config.location.encode('utf-8')
location = (self._get_pos_by_name(location_str.replace(" ", "")))
self.api.set_position(*location)
logger.log('')
logger.log(u'Location Found: {}'.format(self.config.location.decode(
'utf-8')))
logger.log(u'Location Found: {}'.format(self.config.location))
logger.log('GeoPosition: {}'.format(self.position))
logger.log('')
has_position = True
Expand Down

0 comments on commit 014401d

Please sign in to comment.