Skip to content
This repository was archived by the owner on Dec 26, 2024. It is now read-only.
This repository was archived by the owner on Dec 26, 2024. It is now read-only.

UnicodeDecodeError: invalid continuation byte #1

@incognico

Description

@incognico

Sometimes I am getting the error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd8 in position 221: invalid continuation byte and the script fatally exits. Would be great to make this error non-fatal, maybe by using try/expect or something.

Jan 23 17:12:55 twlz python3[1573471]: Udp started: 127.0.0.1:8008
Jan 23 17:12:55 twlz python3[1573471]: INFINITE LOOP; ^C WILL MOST LIKELY NOT WORK!
Jan 23 17:12:55 twlz python3[1573471]: Traceback (most recent call last):
Jan 23 17:12:55 twlz python3[1573471]:   File "/home/svends/gsdddoss.py", line 101, in <module>
Jan 23 17:12:55 twlz python3[1573471]:     for data in udp_server():
Jan 23 17:12:55 twlz python3[1573471]:   File "/home/svends/gsdddoss.py", line 99, in udp_server
Jan 23 17:12:55 twlz python3[1573471]:     yield data[4:-1].decode("utf-8") # has garbag header + ending
Jan 23 17:12:55 twlz python3[1573471]: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd8 in position 221: invalid continuation byte
Jan 23 17:12:55 twlz systemd[1]: gsdddoss.service: Main process exited, code=exited, status=1/FAILURE
Jan 23 17:12:55 twlz systemd[1]: gsdddoss.service: Failed with result 'exit-code'.
Jan 23 17:13:00 twlz systemd[1]: gsdddoss.service: Scheduled restart job, restart counter is at 82.
Jan 23 17:13:00 twlz systemd[1]: Stopped gsdddoss.
Jan 23 17:13:00 twlz systemd[1]: Started gsdddoss.

Additional infos:
Linux, Python 3.10.9,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions