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

UnicodeDecodeError - can't decode byte 0x94 - invalid start byte

Open uzzle1987 opened this issue 10 years ago • 8 comments

Expected Behavior

Bot moves to fort

Actual Behavior

Bot crashs with UnicodeDecodeError

Your FULL config.json (remove your username, password, gmapkey and any other private info)

should not be the reason for the problem

Output when issue occurred

[2016-09-08 10:27:17] [ cli] [INFO] [2016-09-08 10:27:17] [ cli] [INFO] Ran for 0:00:11 [2016-09-08 10:27:17] [ cli] [INFO] Total XP Earned: 0 Average: 0.00/h [2016-09-08 10:27:17] [ cli] [INFO] Travelled 0.00km [2016-09-08 10:27:17] [ cli] [INFO] Visited 0 stops [2016-09-08 10:27:17] [ cli] [INFO] Encountered 0 pokemon, 0 caught, 0 released, 0 evolved, 0 never seen before () [2016-09-08 10:27:17] [ cli] [INFO] Threw 0 pokeballs [2016-09-08 10:27:17] [ cli] [INFO] Earned 0 Stardust [2016-09-08 10:27:17] [ cli] [INFO] Hatched eggs 0 [2016-09-08 10:27:17] [ cli] [INFO] Next egg hatches in 0.79 km [2016-09-08 10:27:17] [ cli] [INFO] [2016-09-08 10:27:17] [ cli] [INFO] Highest CP Pokemon: [2016-09-08 10:27:17] [ cli] [INFO] Most Perfect Pokemon: Traceback (most recent call last): File "C:_COMED\priv\PoGo\PokemonGo-Bot\pokecli.py", line 803, in main() File "C:COMED\priv\PoGo\PokemonGo-Bot\pokecli.py", line 162, in main bot.tick() File "C:COMED\priv\PoGo\PokemonGo-Bot\pokemongo_bot__init.py", line 685, in tick if worker.work() == WorkerResult.RUNNING: File "C:_COMED\priv\PoGo\PokemonGo-Bot\pokemongo_bot\cell_workers\move_to_fort.py", line 87, in work data=fort_event_data File "C:_COMED\priv\PoGo\PokemonGo-Bot\pokemongo_bot\base_task.py", line 43, in emit_event data=data File "C:_COMED\priv\PoGo\PokemonGo-Bot\pokemongo_bot\event_manager.py", line 76, in emit handler.handle_event(event, sender, level, formatted_msg, data) File "C:_COMED\priv\PoGo\PokemonGo-Bot\pokemongo_bot\event_handlers\logging_handler.py", line 140, in handle_event getattr(logger, level)(formatted_msg.encode(sys.stdout.encoding, "replace").decode("utf-8")) File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0x94 in position 43: invalid start byte

Steps to Reproduce

I have just to start the Bot. I think there is a fort in the near with an öäü character.

Other Information

OS: Windows 10 Branch: dev Git Commit: b66fc8854a5594370ecc6a52266251c1a7dc5e13 Python Version: Python 2.7.12

uzzle1987 avatar Sep 08 '16 08:09 uzzle1987

same here

Traceback (most recent call last):
  File "pokecli.py", line 803, in <module>
    main()
  File "pokecli.py", line 162, in main
    bot.tick()
  File "E:\Program Files\PokemonGo-Bot\pokemongo_bot\__init__.py", line 685, in tick
    if worker.work() == WorkerResult.RUNNING:
  File "E:\Program Files\PokemonGo-Bot\pokemongo_bot\cell_workers\move_to_fort.py", line 87, in work
    data=fort_event_data
  File "E:\Program Files\PokemonGo-Bot\pokemongo_bot\base_task.py", line 43, in emit_event
    data=data
  File "E:\Program Files\PokemonGo-Bot\pokemongo_bot\event_manager.py", line 76, in emit
    handler.handle_event(event, sender, level, formatted_msg, data)
  File "E:\Program Files\PokemonGo-Bot\pokemongo_bot\event_handlers\logging_handler.py", line 140, in handle_event
    getattr(logger, level)(formatted_msg.encode(sys.stdout.encoding, "replace").decode("utf-8"))
  File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x82 in position 41: invalid start byte

zx900930 avatar Sep 08 '16 11:09 zx900930

What is the encoding of your stout ? print sys.stdout.encoding

julienlavergne avatar Sep 08 '16 12:09 julienlavergne

Had this too. Google Maps API has had too many requests from you due to restarting the bot too frequently. . Create a new one and replace the one in ./configs/auth.json (or by bash setup.sh create a new auth file

fluxpiada avatar Sep 08 '16 12:09 fluxpiada

@fluxpiada Please create a ticket with your own issue and provide information's. This issue of for the decoding error.

julienlavergne avatar Sep 08 '16 13:09 julienlavergne

@Anakin5: Do I need to put it in a particular part of the script or in general with a new interactive python command line? The two things I tried gave me: cp850.

uzzle1987 avatar Sep 08 '16 13:09 uzzle1987

I am not an expert in Python, but I changed logging_handler.py line 140 back to getattr(logger, level)(formatted_msg) and it works at the moment for me :)

uzzle1987 avatar Sep 08 '16 13:09 uzzle1987

ok, I though utf-8 would at least be able to cover all default encoding but looks like cp850 contains characters bytes that cannot be recognized as valid utf-8. Will commit a fix.

julienlavergne avatar Sep 08 '16 14:09 julienlavergne

Fixed #5297

Gobberwart avatar Sep 09 '16 00:09 Gobberwart