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

error: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range

Open shivamkalra opened this issue 10 years ago • 18 comments

I keep getting ascii codec can't decode error. I've tried fixes in https://github.com/PokemonGoF/PokemonGo-Bot/issues/2686 and https://github.com/PokemonGoF/PokemonGo-Bot/issues/2776 but no luck.

Error Trace

2016-08-08 20:02:18,646 [       cli] [INFO] Most Perfect Pokemon: 
Traceback (most recent call last):
  File "pokecli.py", line 521, in <module>
    main()
  File "pokecli.py", line 95, in main
    bot.tick()
  File "/users/s6kalra/sources/PokemonGo-Bot/pokemongo_bot/__init__.py", line 446, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "/users/s6kalra/sources/PokemonGo-Bot/pokemongo_bot/cell_workers/move_to_map_pokemon.py", line 237, in work
    self.update_map_location()
  File "/users/s6kalra/sources/PokemonGo-Bot/pokemongo_bot/cell_workers/move_to_map_pokemon.py", line 176, in update_map_location
    return log.logger(err, 'red')
NameError: global name 'log' is not defined
2016-08-08 20:02:18,709 [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/s6kalra/sources/PokemonGo-Bot/bot/local/lib/python2.7/site-packages/raven/transport/threaded.py", line 174, in send_sync
    super(ThreadedHTTPTransport, self).send(data, headers)
  File "/users/s6kalra/sources/PokemonGo-Bot/bot/local/lib/python2.7/site-packages/raven/transport/http.py", line 47, in send
    ca_certs=self.ca_certs,
  File "/users/s6kalra/sources/PokemonGo-Bot/bot/local/lib/python2.7/site-packages/raven/utils/http.py", line 66, in urlopen
    return opener.open(url, data, timeout)
  File "/users/s6kalra/sources/PokemonGo-Bot/bot/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 494, in open
    response = self._open(req, data)
  File "/users/s6kalra/sources/PokemonGo-Bot/bot/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 512, in _open
    '_open', req)
  File "/users/s6kalra/sources/PokemonGo-Bot/bot/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 466, in _call_chain
    result = func(*args)
  File "/users/s6kalra/sources/PokemonGo-Bot/bot/local/lib/python2.7/site-packages/raven/utils/http.py", line 46, in https_open
    return self.do_open(ValidHTTPSConnection, req)
  File "/users/s6kalra/sources/PokemonGo-Bot/bot/local/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 "/usr/lib/python2.7/httplib.py", line 1001, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1035, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 997, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 848, in _send_output
    msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128)

Steps to Reproduce

  • Checkout dev branch.
  • Run Pokemongo map and use map config with proper end-point.
  • Note It always happened on Most preferred pokemon step.

Other Information

OS: Linux Git Commit: 4b16e9da985e689d57beae8bf18878f4d872bdc4 Python Version: 2.7.9

shivamkalra avatar Aug 09 '16 00:08 shivamkalra

Right now solving by setting update_map and health_record to false.

shivamkalra avatar Aug 09 '16 00:08 shivamkalra

@shivamkalra I'm in master branch and this doesn't help.

zetasq avatar Aug 09 '16 02:08 zetasq

CAn confirm @shivamkalra fix works!

ghost avatar Aug 09 '16 02:08 ghost

Interesting i got again this problem after today norning git pull.... i try add: "health_record": false, "update_map": false, to config.json give me this:

Traceback (most recent call last): File "pokecli.py", line 521, in main() File "pokecli.py", line 95, in main bot.tick() File "/home/taken/PokemonGo-Bot/pokemongo_bot/init.py", line 441, in tick if worker.work() == WorkerResult.RUNNING: File "/home/taken/PokemonGo-Bot/pokemongo_bot/cell_workers/recycle_items.py", line 37, in work response_dict_recycle = self.send_recycle_item_request(item_id=item_id, count=items_recycle_count) File "/home/taken/PokemonGo-Bot/pokemongo_bot/cell_workers/recycle_items.py", line 64, in send_recycle_item_request count=count File "/home/taken/PokemonGo-Bot/src/pgoapi/pgoapi/pgoapi.py", line 122, in function return request.call() File "/home/taken/PokemonGo-Bot/pokemongo_bot/api_wrapper.py", line 106, in call result = self._call() File "/home/taken/PokemonGo-Bot/pokemongo_bot/api_wrapper.py", line 63, in _call return PGoApiRequest.call(self) File "/home/taken/PokemonGo-Bot/src/pgoapi/pgoapi/pgoapi.py", line 220, in call response = request.request(self._api_endpoint, self._req_method_list, self.get_position()) File "/home/taken/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 129, in request response_dict = self._parse_main_response(response, subrequests) File "/home/taken/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 359, in _parse_main_response response_proto_dict = self._parse_sub_responses(response_proto, subrequests, response_proto_dict) File "/home/taken/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 376, in _parse_sub_responses request_entry = subrequests_list[i] IndexError: list index out of range

takenek avatar Aug 09 '16 03:08 takenek

same as @takenek, but it will restart again and move on for a while then appear "ndexError: list index out of range" again.

denielchiang avatar Aug 09 '16 03:08 denielchiang

Also make sure you run:

 pip uninstall pgoapi && pip install -e git+https://github.com/keyphact/pgoapi.git#egg=pgoapi

So far I've not got this one.

shivamkalra avatar Aug 09 '16 03:08 shivamkalra

I'm getting the same thing as @takenek and @denielchiang, as of latest pull today

muskosan avatar Aug 09 '16 03:08 muskosan

After running your suggestion @shivamkalra still getting ascii errors:

2016-08-08 20:12:00,041 [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/)

muskosan avatar Aug 09 '16 03:08 muskosan

@shivamkalra Thanks for your reply, after I did uninstall and install pgoapi, this happens... :(

2016-08-09 11:19:21,568 [ cli] [INFO] Ran for 0:02:08 2016-08-09 11:19:21,568 [ cli] [INFO] Total XP Earned: 680 Average: 19143.58/h 2016-08-09 11:19:21,568 [ cli] [INFO] Travelled 0.00km 2016-08-09 11:19:21,568 [ cli] [INFO] Visited 1 stops 2016-08-09 11:19:21,568 [ cli] [INFO] Encountered 2 pokemon, 3 caught, 2 released, 0 evolved, 0 never seen before 2016-08-09 11:19:21,568 [ cli] [INFO] Threw 3 pokeballs 2016-08-09 11:19:21,568 [ cli] [INFO] Earned 300 Stardust 2016-08-09 11:19:21,568 [ cli] [INFO] 2016-08-09 11:19:21,568 [ cli] [INFO] Highest CP Pokemon: Staryu [CP: 360] [IV: 13/2/0] Potential: 0.33 2016-08-09 11:19:21,569 [ cli] [INFO] Most Perfect Pokemon: Spearow [CP: 169] [IV: 11/2/8] Potential: 0.47 Traceback (most recent call last): File "pokecli.py", line 521, in main() File "pokecli.py", line 95, in main bot.tick() File "/Users/denielchiang/Game/PokemonGo-Bot/pokemongo_bot/init.py", line 446, in tick if worker.work() == WorkerResult.RUNNING: File "/Users/denielchiang/Game/PokemonGo-Bot/pokemongo_bot/cell_workers/evolve_pokemon.py", line 28, in work response_dict = self.api.get_inventory() File "/Users/denielchiang/Game/PokemonGo-Bot/src/pgoapi/pgoapi/pgoapi.py", line 122, in function return request.call() File "/Users/denielchiang/Game/PokemonGo-Bot/pokemongo_bot/api_wrapper.py", line 106, in call result = self._call() File "/Users/denielchiang/Game/PokemonGo-Bot/pokemongo_bot/api_wrapper.py", line 63, in _call return PGoApiRequest.call(self) File "/Users/denielchiang/Game/PokemonGo-Bot/src/pgoapi/pgoapi/pgoapi.py", line 220, in call response = request.request(self._api_endpoint, self._req_method_list, self.get_position()) File "/Users/denielchiang/Game/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 129, in request response_dict = self._parse_main_response(response, subrequests) File "/Users/denielchiang/Game/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 359, in _parse_main_response response_proto_dict = self._parse_sub_responses(response_proto, subrequests, response_proto_dict) File "/Users/denielchiang/Game/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 376, in _parse_sub_responses request_entry = subrequests_list[i] IndexError: list index out of range ############################################### ##Exit two times with [Ctl+C] to end the loop## ###############################################

denielchiang avatar Aug 09 '16 03:08 denielchiang

I apparently got this issue on 2 out my 10-11 bots. But they started working again after 10 minutes rest. Not a great solution, but try for now.

shivamkalra avatar Aug 09 '16 03:08 shivamkalra

This may not be for a regular user but I changed some of the code in rpc_api.py on pgoapi

 try:
                request_entry = subrequests_list[i]
except Exception as e:
                print subrequests_list
                self.log.info("Error - something strange happened... I don't know why")
                continue

I think the api is being bombarded and results in an error. Not sure how this helps. I am going to observe this

franciszabala avatar Aug 09 '16 03:08 franciszabala

@shivamkalra, i did nothing and just restarted it 15 mins ago and so far so good. I didn't see any error message appears again. Take a 10 min rest may really helped, thank you!

@franciszabala, I also added this part of log into roc_api.py and if this exception happens next time, i will observe this log...thanks :)

denielchiang avatar Aug 09 '16 04:08 denielchiang

Now it becomes to this, but still works after auto-restart it...watching it now

2016-08-09 13:10:37,707 [ cli] [INFO] Most Perfect Pokemon: Goldeen [CP: 370] [IV: 13/13/11] Potential: 0.82 Traceback (most recent call last): File "pokecli.py", line 521, in main() File "pokecli.py", line 95, in main bot.tick() File "/Users/denielchiang/Game/PokemonGo-Bot/pokemongo_bot/init.py", line 446, in tick if worker.work() == WorkerResult.RUNNING: File "/Users/denielchiang/Game/PokemonGo-Bot/pokemongo_bot/cell_workers/evolve_pokemon.py", line 28, in work response_dict = self.api.get_inventory() File "/Users/denielchiang/Game/PokemonGo-Bot/src/pgoapi/pgoapi/pgoapi.py", line 122, in function return request.call() File "/Users/denielchiang/Game/PokemonGo-Bot/pokemongo_bot/api_wrapper.py", line 106, in call result = self._call() File "/Users/denielchiang/Game/PokemonGo-Bot/pokemongo_bot/api_wrapper.py", line 63, in _call return PGoApiRequest.call(self) File "/Users/denielchiang/Game/PokemonGo-Bot/src/pgoapi/pgoapi/pgoapi.py", line 220, in call response = request.request(self._api_endpoint, self._req_method_list, self.get_position()) File "/Users/denielchiang/Game/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 126, in request request_proto = self._build_main_request(subrequests, player_position) File "/Users/denielchiang/Game/PokemonGo-Bot/src/pgoapi/pgoapi/rpc_api.py", line 216, in _build_main_request request.auth_info.token.contents = self._auth_provider.get_access_token() TypeError: None has type NoneType, but expected one of: bytes, unicode

denielchiang avatar Aug 09 '16 05:08 denielchiang

After pull the newest version 6 hours ago it never happened again... Probably the problem is fixed in some version.

denielchiang avatar Aug 09 '16 16:08 denielchiang

I still got this issue, can someone check this again?

zetasq avatar Aug 11 '16 10:08 zetasq

2016-08-11 18:36:48,666 [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/site-packages/raven/transport/threaded.py", line 174, in send_sync super(ThreadedHTTPTransport, self).send(data, headers) File "/usr/local/lib/python2.7/site-packages/raven/transport/http.py", line 47, in send ca_certs=self.ca_certs, File "/usr/local/lib/python2.7/site-packages/raven/utils/http.py", line 66, in urlopen return opener.open(url, data, timeout) File "/usr/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 494, in open response = self._open(req, data) File "/usr/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 512, in _open '_open', req) File "/usr/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 466, in _call_chain result = func(*args) File "/usr/local/lib/python2.7/site-packages/raven/utils/http.py", line 46, in https_open return self.do_open(ValidHTTPSConnection, req) File "/usr/local/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 "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1057, in request self._send_request(method, url, body, headers) File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1097, in _send_request self.endheaders(body) File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1053, in endheaders self._send_output(message_body) File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/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)

zetasq avatar Aug 11 '16 10:08 zetasq

I get it too since a master update (of yesterday changes)

jeromecharron avatar Aug 18 '16 12:08 jeromecharron

Same here.. Was working til I did the latest update two days ago.. Any solution?

ericliam avatar Sep 18 '16 02:09 ericliam