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

Can't decode byte 0x9c in position 1: ordinal not in range(128)

Open BaiqingL opened this issue 10 years ago • 13 comments

Error console output, directly after a successful login: Traceback (most recent call last): File "pokecli.py", line 843, in main() File "pokecli.py", line 202, in main bot.tick() File "/home/PokemonGo-Bot/pokemongo_bot/init.py", line 770, in tick if worker.work() == WorkerResult.RUNNING: File "/home/PokemonGo-Bot/pokemongo_bot/cell_workers/buddy_pokemon.py", line 108, in work pokemon = self._get_pokemon_by_name(self._get_pokemon_by_id(self.buddy['id']).name) KeyError: 'id' [2016-11-07 17:16:02] [MainThread] [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 "/home/PokemonGo-Bot/local/lib/python2.7/site-packages/raven/transport/threaded.py", line 174, in send_sync super(ThreadedHTTPTransport, self).send(data, headers) File "/home/PokemonGo-Bot/local/lib/python2.7/site-packages/raven/transport/http.py", line 47, in send ca_certs=self.ca_certs, File "/home/PokemonGo-Bot/local/lib/python2.7/site-packages/raven/utils/http.py", line 66, in urlopen return opener.open(url, data, timeout) File "/home/PokemonGo-Bot/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 494, in open response = self._open(req, data) File "/home/PokemonGo-Bot/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 512, in _open '_open', req) File "/home/PokemonGo-Bot/local/lib/python2.7/site-packages/future/backports/urllib/request.py", line 466, in _call_chain result = func(*args) File "/home/PokemonGo-Bot/local/lib/python2.7/site-packages/raven/utils/http.py", line 46, in https_open return self.do_open(ValidHTTPSConnection, req) File "/home/PokemonGo-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 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-11-07 17:16:02] [MainThread] [sentry.errors.uncaught] [ERROR] [u"KeyError: 'id'", u' File "pokecli.py", line 843, in ', u' File "pokecli.py", line 202, in main', u' File "pokemongo_bot/init.py", line 770, in tick', u' File "pokemongo_bot/cell_workers/buddy_pokemon.py", line 108, in work'] Mon Nov 7 17:16:02 EST 2016 Pokebot Stopped. Press any button or wait 20 seconds to continue.

BaiqingL avatar Nov 07 '16 22:11 BaiqingL

Apparently the devs implemented sentry as an error reporting system.

BaiqingL avatar Nov 07 '16 22:11 BaiqingL

Getting the same error.

SapitoSucio avatar Nov 08 '16 01:11 SapitoSucio

quick fix is replace self.buddy['last_km_awarded'] in "/PokemonGo-Bot/pokemongo_bot/cell_workers/buddy_pokemon.py" with a default value or fix the key issue by defining it properly.

then save and compile the py $ sudo python -m py_compile buddy_pokemon.py

then sudo ./run.sh

*TESTED WITH PTC

SoulSkare avatar Nov 08 '16 04:11 SoulSkare

@SoulSkare which line ?, can show how you mod it ?

keatliang2005 avatar Nov 08 '16 06:11 keatliang2005

Problem is the code is calling a property of an empty object when you haven't selected a buddy on your account.

Temporary fix would be to replace the line 108 on pokemongo_bot -> cell_workers -> buddy_pokemon.py

pokemon = self._get_pokemon_by_name(self._get_pokemon_by_id(self.buddy['id']).name) To pokemon = self._get_pokemon_by_name(self._get_pokemon_by_id(self.buddy['id']).name) if "id" in self.buddy else None

pablossp avatar Nov 08 '16 07:11 pablossp

@pablossp the hotfix works 👍

keatliang2005 avatar Nov 08 '16 08:11 keatliang2005

@pablossp to me fails with a new account on function _check_old_reward() line 223.

I've to change from this: km_diff = self._km_walked() - self.buddy['last_km_awarded'] on line 226

to this: if self.buddy.has_key('last_km_awarded'): km_diff = self._km_walked() - self.buddy['last_km_awarded'] else: self.buddy['last_km_awarded'] = 0 km_diff = self._km_walked() - self.buddy['last_km_awarded']

Now it's working for me. I don't know how to make a push request :/

serxoz avatar Nov 08 '16 08:11 serxoz

So the hotfix is included in the file now but still getting the error. I also added buddy pokemon with my brother's phone but still getting error. Anyone has any ideas?

tunayuyar avatar Nov 09 '16 08:11 tunayuyar

It should be working. Maybe try the ./setup.sh -u && ./setup.sh -r?

BaiqingL avatar Nov 09 '16 15:11 BaiqingL

@VBQL unless something changed since my last reply, it wont do any good. I did a clean setup.

tunayuyar avatar Nov 09 '16 16:11 tunayuyar

@tunayuyar Then yeah sorry I have no idea. You should also stop botting because API level .45 is now enforced lol

BaiqingL avatar Nov 09 '16 21:11 BaiqingL

Well nobody can bot with this unless proper fix comes. Thanks anyway.

tunayuyar avatar Nov 09 '16 21:11 tunayuyar

Adding


        if not 'last_km_awarded' in self.buddy or ('last_km_awarded' in self.buddy and not isinstance(self.buddy['last_km_awarded'],int)):
            self.buddy['last_km_awarded']=0



on line 137 worked for me

mlussi avatar Feb 21 '17 10:02 mlussi