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

'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128) when snipe

Open mrwbsn opened this issue 10 years ago • 8 comments

Expected Behavior

run snipe

Actual Behavior

stop when run move_to_map_pokemon.py and get error:

Traceback (most recent call last):
  File "pokecli.py", line 503, in <module>
    main()
  File "pokecli.py", line 89, in main
    bot.tick()
  File "/Users/mrwbsn/Workspaces/pogobot/pokemongo_bot/__init__.py", line 434, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/Users/mrwbsn/Workspaces/pogobot/pokemongo_bot/cell_workers/move_to_map_pokemon.py", line 255, in work
    return self.snipe(pokemon)
  File "/Users/mrwbsn/Workspaces/pogobot/pokemongo_bot/cell_workers/move_to_map_pokemon.py", line 214, in snipe
    self._teleport_back()
  File "/Users/mrwbsn/Workspaces/pogobot/pokemongo_bot/cell_workers/move_to_map_pokemon.py", line 339, in _teleport_back
    data={'last_lat': last_position[0], 'last_lon': last_position[1]}
  File "/Users/mrwbsn/Workspaces/pogobot/pokemongo_bot/base_task.py", line 27, in emit_event
    data=data
  File "/Users/mrwbsn/Workspaces/pogobot/pokemongo_bot/event_manager.py", line 61, in emit
    formatted_msg = formatted.format(**data)
KeyError: 'last_long'
2016-08-08 12:11:08,403 [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/mrwbsn/Workspaces/pogobot/lib/python2.7/site-packages/raven/transport/threaded.py", line 174, in send_sync
    super(ThreadedHTTPTransport, self).send(data, headers)
  File "/Users/mrwbsn/Workspaces/pogobot/lib/python2.7/site-packages/raven/transport/http.py", line 47, in send
    ca_certs=self.ca_certs,
  File "/Users/mrwbsn/Workspaces/pogobot/lib/python2.7/site-packages/raven/utils/http.py", line 66, in urlopen
    return opener.open(url, data, timeout)
  File "/Users/mrwbsn/Workspaces/pogobot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 494, in open
    response = self._open(req, data)
  File "/Users/mrwbsn/Workspaces/pogobot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 512, in _open
    '_open', req)
  File "/Users/mrwbsn/Workspaces/pogobot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 466, in _call_chain
    result = func(*args)
  File "/Users/mrwbsn/Workspaces/pogobot/lib/python2.7/site-packages/raven/utils/http.py", line 46, in https_open
    return self.do_open(ValidHTTPSConnection, req)
  File "/Users/mrwbsn/Workspaces/pogobot/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 "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1053, in request
    self._send_request(method, url, body, headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1093, in _send_request
    self.endheaders(body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1049, in endheaders
    self._send_output(message_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 891, in _send_output
    msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128)
2016-08-08 12:11:08,404 [sentry.errors.uncaught] [ERROR] [u"KeyError: 'last_long'", u'  File "pokecli.py", line 503, in <module>', u'  File "pokecli.py", line 89, in main', u'  File "pokemongo_bot/__init__.py", line 434, in tick', u'  File "pokemongo_bot/cell_workers/move_to_map_pokemon.py", line 255, in work', u'  File "pokemongo_bot/cell_workers/move_to_map_pokemon.py", line 214, in snipe', u'  File "pokemongo_bot/cell_workers/move_to_map_pokemon.py", line 339, in _teleport_back', u'  File "pokemongo_bot/base_task.py", line 27, in emit_event', u'  File "pokemongo_bot/event_manager.py", line 61, in emit']

Steps to Reproduce

run with MoveToMapPokemon Tasks

Other Information

OS: OSX Git Commit: 563f898f61233ff86d38d83b68d8399c1f63051b Python Version: Python 2.7.10

mrwbsn avatar Aug 08 '16 05:08 mrwbsn

theres a problem with the Snipe" type in the configs . i hope someone can fix

JohnnyOmm avatar Aug 08 '16 05:08 JohnnyOmm

I had this error too.

reload(sys)
sys.setdefaultencoding('utf-8')

When I put this code under import sys in file 'pokecli.py', the error fixed.

OS:windows 7 python: 2.7

Samtoto avatar Aug 08 '16 05:08 Samtoto

@Samtoto I have add those code below import sys but still no luck

mrwbsn avatar Aug 08 '16 06:08 mrwbsn

There's a typo in this file: "/Users/mrwbsn/Workspaces/pogobot/pokemongo_bot/cell_workers/move_to_map_pokemon.py". On line 338, in _teleport_back, the 'last_long' keyword argument should be 'last_lon'.

formatted=('Teleporting back to previous location ({last_lat}, '
-                       '{last_long})'),
+                       '{last_lon})'),

shoelsch avatar Aug 08 '16 06:08 shoelsch

@shoelsch My move_to_map_pokemon.py file don't have 338 lines? Are you sure it's this file you've made the changes to?

mike9011 avatar Aug 08 '16 06:08 mike9011

@mike9011 I'm using latest commit on the dev branch: https://github.com/PokemonGoF/PokemonGo-Bot/commit/bdcf2519d63555ac32246439fd17672896ee64e4#diff-13dfb7470ca1360a74ad4eabf7bb11a2R338

shoelsch avatar Aug 08 '16 06:08 shoelsch

I already submitted a PR (#3003) just wait it get merged.

raulgbcr avatar Aug 08 '16 06:08 raulgbcr

@raulgbcr nice! now it works. thank you everyone! can't wait to see this fix is merged.

mrwbsn avatar Aug 08 '16 08:08 mrwbsn