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

bot crashed with UnicodeDecodeError

Open buzzo123 opened this issue 10 years ago • 5 comments

my bot crash with this:

Traceback (most recent call last):
  File "pokecli.py", line 521, in <module>
    main()
  File "pokecli.py", line 95, in main
    bot.tick()
  File "/home/buzzo/Desktop/pogo/PokemonGo-Bot-master/pokemongo_bot/__init__.py", line 441, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/home/buzzo/Desktop/pogo/PokemonGo-Bot-master/pokemongo_bot/cell_workers/evolve_pokemon.py", line 28, in work
    response_dict = self.api.get_inventory()
  File "/home/buzzo/Desktop/pogo/PokemonGo-Bot-master/src/pgoapi/pgoapi/pgoapi.py", line 122, in function
    return request.call()
  File "/home/buzzo/Desktop/pogo/PokemonGo-Bot-master/pokemongo_bot/api_wrapper.py", line 106, in call
    result = self._call()
  File "/home/buzzo/Desktop/pogo/PokemonGo-Bot-master/pokemongo_bot/api_wrapper.py", line 63, in _call
    return PGoApiRequest.call(self)
  File "/home/buzzo/Desktop/pogo/PokemonGo-Bot-master/src/pgoapi/pgoapi/pgoapi.py", line 220, in call
    response = request.request(self._api_endpoint, self._req_method_list, self.get_position())
  File "/home/buzzo/Desktop/pogo/PokemonGo-Bot-master/src/pgoapi/pgoapi/rpc_api.py", line 126, in request
    request_proto = self._build_main_request(subrequests, player_position)
  File "/home/buzzo/Desktop/pogo/PokemonGo-Bot-master/src/pgoapi/pgoapi/rpc_api.py", line 216, in _build_main_request
    request.auth_info.token.contents = self._auth_provider.get_access_token()
  File "/home/buzzo/Desktop/pogo/PokemonGo-Bot-master/src/pgoapi/pgoapi/auth_ptc.py", line 145, in get_access_token
    raise AuthException("Could not retrieve a PTC Access Token")
pgoapi.exceptions.AuthException: Could not retrieve a PTC Access Token
2016-08-09 21:49:23,840 [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 "/usr/local/lib/python2.7/dist-packages/raven/transport/threaded.py", line 174, in send_sync
    super(ThreadedHTTPTransport, self).send(data, headers)
  File "/usr/local/lib/python2.7/dist-packages/raven/transport/http.py", line 47, in send
    ca_certs=self.ca_certs,
  File "/usr/local/lib/python2.7/dist-packages/raven/utils/http.py", line 66, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python2.7/dist-packages/future/backports/urllib/request.py", line 494, in open
    response = self._open(req, data)
  File "/usr/local/lib/python2.7/dist-packages/future/backports/urllib/request.py", line 512, in _open
    '_open', req)
  File "/usr/local/lib/python2.7/dist-packages/future/backports/urllib/request.py", line 466, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python2.7/dist-packages/raven/utils/http.py", line 46, in https_open
    return self.do_open(ValidHTTPSConnection, req)
  File "/usr/local/lib/python2.7/dist-packages/future/backports/urllib/request.py", line 1284, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "/usr/lib/python2.7/httplib.py", line 1057, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1097, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 1053, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 895, in _send_output
    msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128)
2016-08-09 21:49:24,094 [sentry.errors.uncaught] [ERROR] [u'AuthException: Could not retrieve a PTC Access Token', u'  File "pokecli.py", line 521, in <module>', u'  File "pokecli.py", line 95, in main', u'  File "pokemongo_bot/__init__.py", line 441, in tick', u'  File "pokemongo_bot/cell_workers/evolve_pokemon.py", line 28, in work', u'  File "pgoapi/pgoapi.py", line 122, in function', u'  File "pokemongo_bot/api_wrapper.py", line 106, in call', u'  File "pokemongo_bot/api_wrapper.py", line 63, in _call', u'  File "pgoapi/pgoapi.py", line 220, in call', u'  File "pgoapi/rpc_api.py", line 126, in request', u'  File "pgoapi/rpc_api.py", line 216, in _build_main_request', u'  File "pgoapi/auth_ptc.py", line 145, in get_access_token']
Sentry is attempting to send 1 pending error messages
Waiting up to 10 seconds
Press Ctrl-C to quit

buzzo123 avatar Aug 09 '16 19:08 buzzo123

I get the same error after about an hour of bot-time

Sijmenjeromkok avatar Aug 09 '16 20:08 Sijmenjeromkok

got the same any solutions?

tvpman avatar Aug 09 '16 20:08 tvpman

Restart the bot...

chr1spy avatar Aug 09 '16 21:08 chr1spy

Yup restart the bot is a solution. This exception is occuring when...

pgoapi.exceptions.AuthException: Could not retrieve a PTC Access Token

So either it crashing out is expected behaviour or the bot needs updating to handle this exception and perhaps try getting another PTC access token.

Quantra avatar Aug 09 '16 21:08 Quantra

restart is a solution, but i report this bug so someone can fix it :)

buzzo123 avatar Aug 09 '16 22:08 buzzo123