UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 17: invalid continuation byte

Hi,

I am confronted with ERROR (MainThread) [root] Uncaught exception
Traceback (most recent call last) during execution of:

[python.exe -m homeassistant]

on a Windows 10 machine with Python 3.8.5 on it. It stopped with the message

UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xe9 in position 17: invalid continuation byte

Unfortunatly I was not able to find the solution on the web.

Thanks in advance,
LLL

Hi All,

Nobody has a clue how to resolve this?

Thanks in advance,
LLL

Does your username on Windows have an ‘é’ character in it?

Hi, i have the same issue and yes i have an “é” character in my username on windows.
Actually this occur wen i try to execute auto-py-to-exe.

Also i know if i change the username on Windows it may be result of other problem whit other programme. So i don’t really know what to do to solve this problem.

Thank a lot in advance.

Disclaimer: I don’t use Windows so I cannot check if anything that follows works or even makes sense :wink:

Try setting your console to UTF-8 using this command: chcp 65001

Or, possibly, run the command from a directory that doesn’t contain your username.

1 Like

Ok thank a lot robertklep, i will try to setting my console/terminal and see what this do.
also try it in a another directory.

This will solve UnicodeDecodeError :

df.read_csv('file_name.csv', engine='python')

The pd.read_csv documentation notes specific differences between ‘c’ (default) and ‘python’ engines. The names indicate the language in which the parsers are written.

Files store bytes, which means all unicode have to be encoded into bytes before they can be stored in a file. The pandas read_csv() takes an encoding option to deal with files in different formats. So, you can specify an encoding, such as utf-8.

df.read_csv('filename.csv',encoding='utf-8')

I am getting this error every 1 hour

ERROR (MainThread) [homeassistant] Error doing job: Exception in callback _SelectorDatagramTransport._read_ready()
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 1021, in _read_ready
    self._protocol.datagram_received(data, addr)
  File "/usr/local/lib/python3.8/site-packages/aiodiscover/discovery.py", line 66, in datagram_received
    msg = DNSMessage.parse(data)
  File "/usr/local/lib/python3.8/site-packages/async_dns/core/record.py", line 336, in parse
    l, ans.an = ans.parse_entry(RESPONSE, data, l, an)
  File "/usr/local/lib/python3.8/site-packages/async_dns/core/record.py", line 317, in parse_entry
    l = r.parse(data, l)
  File "/usr/local/lib/python3.8/site-packages/async_dns/core/record.py", line 216, in parse
    _, self.data = utils.load_domain_name(data, l)
  File "/usr/local/lib/python3.8/site-packages/async_dns/core/utils.py", line 49, in load_domain_name
    data = b'.'.join(parts).decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 1: invalid start byte

I have not idea where to look for the decode error.
I am running Home Assistant OS on a NUC. Problem started when I upgraded to 2021.4

Just in case it is helpful to anyone else, I got this error today after “factory resetting” some smart blinds.

Turns out that the factory reset, disconnected the device from my tuya cloud “project” and ultimately changed the local device key

I had to log into the Tuya cloud, set the link to manual, link the device, reset the linkage to automatic.

Then I got the the tuya local keys again using the tuya-cli wizard

Once I had the keys, I could see that the local device key for the smart blinds had changed.

Re-configured that device in the localtuya integration, supplying the correct device key, restarted HA and the error disappeared

I am on 2022.4.7