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

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

Open arnaudgs opened this issue 10 years ago • 15 comments

Expected Behavior

Bot start

Actual Behavior

When starting bot I got this error

2016-08-07 13:17:38,327 [       cli] [INFO] PokemonGO Bot v1.0
2016-08-07 13:17:38,330 [       cli] [INFO] Configuration initialized
2016-08-07 13:17:38,330 [pokemongo_bot.health_record.bot_event] [INFO] Health check is enabled. For more logrmation:
2016-08-07 13:17:38,330 [pokemongo_bot.health_record.bot_event] [INFO] https://github.com/PokemonGoF/PokemonGo-Bot/tree/dev#analytics
2016-08-07 13:17:38,345 [requests.packages.urllib3.connectionpool] [INFO] Starting new HTTP connection (1): www.google-analytics.com
2016-08-07 13:17:40,746 [PokemonGoBot] [INFO] [set_start_location] Setting start location.
2016-08-07 13:17:40,746 [PokemonGoBot] [INFO] [x] Coordinates found in passed in location, not geocoding.
2016-08-07 13:17:40,747 [PokemonGoBot] [INFO] [location_found] Location found: 48.875776,2.3309463 (48.875776, 2.3309463, 0.0)
2016-08-07 13:17:40,747 [PokemonGoBot] [INFO] [position_update] Now at (48.875776, 2.3309463, 0)
2016-08-07 13:17:40,748 [PokemonGoBot] [INFO] [login_started] Login procedure started.
2016-08-07 13:17:46,564 [PokemonGoBot] [INFO] [login_successful] Login successful.
2016-08-07 13:17:47,675 [PokemonGoBot] [INFO]
2016-08-07 13:17:47,676 [PokemonGoBot] [INFO] --- <pokemonusername> ---
2016-08-07 13:17:47,676 [PokemonGoBot] [INFO] Level: XX (Next Level: 72115 XP) (Total: XXXXXXX XP)
2016-08-07 13:17:47,676 [PokemonGoBot] [INFO] Pokemon Captured: XXXX | Pokestops Visited: XXX
2016-08-07 13:17:47,677 [PokemonGoBot] [INFO] Pokemon Bag: XXX/250
2016-08-07 13:17:47,677 [PokemonGoBot] [INFO] Items: XXX/350
2016-08-07 13:17:47,677 [PokemonGoBot] [INFO] Stardust: XXXXXX | Pokecoins: 0
2016-08-07 13:17:47,678 [PokemonGoBot] [INFO] PokeBalls: XX | GreatBalls: 18 | UltraBalls: 100
2016-08-07 13:17:47,678 [PokemonGoBot] [INFO] RazzBerries: 40 | BlukBerries: 0 | NanabBerries: 0
2016-08-07 13:17:47,678 [PokemonGoBot] [INFO] LuckyEgg: 5 | Incubator: 0 | TroyDisk: 6
2016-08-07 13:17:47,678 [PokemonGoBot] [INFO] Potion: 0 | SuperPotion: 1 | HyperPotion: 2
2016-08-07 13:17:47,678 [PokemonGoBot] [INFO] Incense: 9 | IncenseSpicy: 0 | IncenseCool: 0
2016-08-07 13:17:47,678 [PokemonGoBot] [INFO] Revive: 40 | MaxRevive: 0
2016-08-07 13:17:47,678 [PokemonGoBot] [INFO]
2016-08-07 13:17:47,678 [PokemonGoBot] [INFO]
2016-08-07 13:17:47,696 [sentry.errors.serializer] [ERROR] maximum recursion depth exceeded while calling a Python object
Traceback (most recent call last):
  File "/Users/<pokebotfolder>/pokebot/lib/python2.7/site-packages/raven/utils/serializer/manager.py", line 76, in transform
    return repr(value)
 File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 383, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
RuntimeError: maximum recursion depth exceeded while calling a Python object
Traceback (most recent call last):
  File "./pokecli.py", line 501, in <module>
    main()
  File "./pokecli.py", line 130, in main
    report_summary(bot)
  File "./pokecli.py", line 139, in report_summary
    metrics.capture_stats()
  File "/Users/<pokebotfolder>/pokebot/pokemongo_bot/metrics.py", line 76, in capture_stats
    response_dict = request.call()
  File "/Users/<pokebotfolder>/pokebot/pokemongo_bot/api_wrapper.py", line 106, in call
    result = self._call()
  File "/Users/<pokebotfolder>/pokebot/pokemongo_bot/api_wrapper.py", line 63, in _call
    return PGoApiRequest.call(self)
  File "/Users/<pokebotfolder>/pokebot/src/pgoapi/pgoapi/pgoapi.py", line 210, in call
    request.activate_signature(lib_path)
  File "/Users/<pokebotfolder>/pokebot/src/pgoapi/pgoapi/rpc_api.py", line 85, in activate_signature
    self._signature_lib = ctypes.cdll.LoadLibrary(lib_path)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(encrypt.so, 6): image not found
2016-08-07 13:17:47,716 [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/<pokebotfolder>/pokebot/lib/python2.7/site-packages/raven/transport/threaded.py", line 174, in send_sync
    super(ThreadedHTTPTransport, self).send(data, headers)
  File "/Users/<pokebotfolder>/pokebot/lib/python2.7/site-packages/raven/transport/http.py", line 47, in send
    ca_certs=self.ca_certs,
  File "/Users/<pokebotfolder>/pokebot/lib/python2.7/site-packages/raven/utils/http.py", line 66, in urlopen
    return opener.open(url, data, timeout)
  File "/Users/<pokebotfolder>/pokebot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 494, in open
    response = self._open(req, data)
  File "/Users/<pokebotfolder>/pokebot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 512, in _open
    '_open', req)
  File "/Users/<pokebotfolder>/pokebot/lib/python2.7/site-packages/future/backports/urllib/request.py", line 466, in _call_chain
    result = func(*args)
  File "/Users/<pokebotfolder>/pokebot/lib/python2.7/site-packages/raven/utils/http.py", line 46, in https_open
    return self.do_open(ValidHTTPSConnection, req)
  File "/Users/<pokebotfolder>/pokebot/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.11/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.11/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.11/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.11/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)
2016-08-07 13:17:47,722 [sentry.errors.uncaught] [ERROR] [u'OSError: dlopen(encrypt.so, 6): image not found', u'  File "pokecli.py", line 501, in <module>', u'  File "pokecli.py", line 130, in main', u'  File "pokecli.py", line 139, in report_summary', u'  File "pokemongo_bot/metrics.py", line 76, in capture_stats', 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 210, in call', u'  File "pgoapi/rpc_api.py", line 85, in activate_signature', u'  File "ctypes/__init__.py", line 443, in LoadLibrary', u'  File "ctypes/__init__.py", line 365, in __init__']

Steps to Reproduce

Other Information

OS: Git Commit: d5bb09fd758e779b8eee859d8374f0d198e58abb Python Version: Python 2.7.11

arnaudgs avatar Aug 07 '16 11:08 arnaudgs

dlopen(encrypt.so, 6): image not found you're missing the encrypt.so in your main folder. Search on slack or here for links and watch out that you get the right encrypt.so for your OS / Architecture

tomalbrc avatar Aug 07 '16 11:08 tomalbrc

@tomalbrc do u have a link or explain us on where to get it? and how to use it? thanks

i did download and ran

wget http://pgoapi.com/pgoencrypt.tar.gz && tar -xf pgoencrypt.tar.gz && cd pgoencrypt/src/ && make

and also download it from

https://slack-files.com/T1U6G9ZEW-F1YV50RGQ-cc979942b7

put the libencrypt.so and encrypt.so on the main directory and same issue happen

kolet avatar Aug 07 '16 11:08 kolet

Delete encrypt.so and rename libencrypt.so to encrypt.so

Basically you need to rename the libencrypt.so file the makefile outputs to encrypt.so and copy it to your main folder

Run: wget http://pgoapi.com/pgoencrypt.tar.gz && tar -xf pgoencrypt.tar.gz && cd pgoencrypt/src/ && make && mv libencrypt.so encrypt.so Then copy encrypt.so into your bots main folder.

EDIT: Just checked and works on OS X and Linux for me

tomalbrc avatar Aug 07 '16 11:08 tomalbrc

Replace import sys in pokecli.py with this

reload(sys)
sys.setdefaultencoding('UTF8')

Bramzor avatar Aug 07 '16 11:08 Bramzor

If the renaming doesnt work, too do this: in PokemonGo-Bot/pokemongo_bot edit the file __init__.py and replace this self.api.activate_signature("encrypt.so") with this encrypt_path = os.path.abspath("./encrypt.so") self.api.activate_signature(encrypt_path) Regards

ErrorFlexXx avatar Aug 07 '16 11:08 ErrorFlexXx

Solution The above soulution by ErrorFlexXx fixed it.

ib0b avatar Aug 07 '16 11:08 ib0b

@ErrorFlexXx @tomalbrc thanks alot to u 2

here a full fix

ok listen up what u have to do if u are on linnux or mac

Basically you need to rename the libencrypt.so file the makefile outputs to encrypt.so and copy it to your main folder

Run: wget http://pgoapi.com/pgoencrypt.tar.gz && tar -xf pgoencrypt.tar.gz && cd pgoencrypt/src/ && make && mv libencrypt.so encrypt.so

Then copy encrypt.so into your bots main folder.

if that does not work edit in PokemonGo-Bot/pokemongo_bot edit the file __init__.py and replace this self.api.activate_signature("encrypt.so") with this encrypt_path = os.path.abspath("./encrypt.so") self.api.activate_signature(encrypt_path) Regards

like i did here, i commet #self.api.activate_signature("encrypt.so") and add
encrypt_path = os.path.abspath("./encrypt.so") self.api.activate_signature(encrypt_path) http://image.prntscr.com/image/4fc363635d404637b6c3e797cfa13306.png

kolet avatar Aug 07 '16 11:08 kolet

Does anyone have the link for encrypt.so for windows OS? Thanks. EDIT: I found the file in the slack channel files remember to change self.api.activate_signature("./encrypt.so") to self.api.activate_signature("./fileName")

TopOneOfTopOne avatar Aug 07 '16 12:08 TopOneOfTopOne

i still get

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-07 20:10:31,793 [sentry.errors.uncaught] [ERROR] [u"UnboundLocalError: local variable 'bot' referenced before assignment", u' File "pokecli.py", line 493, in ', u' File "pokecli.py", line 126, in main']

Done so far :

  • clone latest file (master branch)
  • install requirements

- Run: wget http://pgoapi.com/pgoencrypt.tar.gz && tar -xf pgoencrypt.tar.gz && cd pgoencrypt/src/ && make && mv libencrypt.so encrypt.so (move the encryopt.so to PokemonGo-Bot/)

Change => self.api.activate_signature("encrypt.so") To => encrypt_path = os.path.abspath("./encrypt.so") self.api.activate_signature(encrypt_path)

AradeaTechno avatar Aug 07 '16 12:08 AradeaTechno

#2768

k4n30 avatar Aug 07 '16 12:08 k4n30

Same issue, worked for me.thx @ErrorFlexXx

tlgbrkc avatar Aug 07 '16 13:08 tlgbrkc

Same issue, i used steps provided by @tomalbrc and @ErrorFlexXx . After that, works perfectly.

firzzen avatar Aug 07 '16 13:08 firzzen

What about installation via docker?

refast avatar Aug 07 '16 13:08 refast

Hi, all solution still not work for me

what i've done so far :

  1. Clone the files from git
  2. Install all requirements
  3. Change config.json.example (to : config.json, also set it (Username, Pass, Location, API) )
  4. run : wget http://pgoapi.com/pgoencrypt.tar.gz && tar -xf pgoencrypt.tar.gz && cd pgoencrypt/src/ && make && mv libencrypt.so encrypt.so (Then copy encrypt.so to PokemonGo-Bot/)
  5. Change __ init __.py with #self.api.activate_signature("encrypt.so") encrypt_path = os.path.abspath("./encrypt.so") self.api.activate_signature(encrypt_path)

then, when i run

python pokecli.py -cf configs/config.json

I Got this

2016-08-07 22:13:22,276 [ cli] [INFO] PokemonGO Bot v1.0 2016-08-07 22:13:22,279 [ cli] [INFO] Configuration initialized 2016-08-07 22:13:22,280 [pokemongo_bot.health_record.bot_event] [INFO] Health check is enabled. For more logrmation: 2016-08-07 22:13:22,280 [pokemongo_bot.health_record.bot_event] [INFO] https://github.com/PokemonGoF/PokemonGo-Bot/tree/dev#analytics 2016-08-07 22:13:22,283 [requests.packages.urllib3.connectionpool] [INFO] Starting new HTTP connection (1): www.google-analytics.com Traceback (most recent call last): File "pokecli.py", line 501, in main() File "pokecli.py", line 132, in main raise e requests.exceptions.HTTPError: 403 Client Error: Request blocked by Privoxy for url: http://www.google-analytics.com/collect 2016-08-07 22:13:22,298 [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-07 22:13:22,299 [sentry.errors.uncaught] [ERROR] [u'HTTPError: 403 Client Error: Request blocked by Privoxy for url: http://www.google-analytics.com/collect', u' File "pokecli.py", line 501, in ', u' File "pokecli.py", line 132, in main']

Is there anything wrong with my step ??

Appreciate all helps

SOLVED!!!

What makes it solve is

I Turn Off ( health_record ) in my config.js

health_record = FALSE

AradeaTechno avatar Aug 07 '16 14:08 AradeaTechno

Can someone provide a link for encrypt.so compatible with x86 windows OS please.

rahul1205 avatar Aug 07 '16 15:08 rahul1205