Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
uzzle1987 opened this issue Sep 8, 2016 · 8 comments
Closed

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

uzzle1987 opened this issue Sep 8, 2016 · 8 comments
Assignees
Labels

Comments

@uzzle1987
Copy link

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:
b66fc88
Python Version:
Python 2.7.12

@zx900930
Copy link

zx900930 commented Sep 8, 2016

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

@julienlavergne
Copy link
Contributor

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

@fluxpiada
Copy link

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

@julienlavergne
Copy link
Contributor

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

@uzzle1987
Copy link
Author

@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
Copy link
Author

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 :)

@julienlavergne
Copy link
Contributor

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.

@Gobberwart
Copy link
Contributor

Fixed #5297

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants