I recently ran into a problem with the system default encoding when using steam-acolyte.
And here‘s the error log:
Traceback (most recent call last):
File "C:\Users\Vita\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Vita\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "c:\users\vita\.local\bin\steam-acolyte.exe\__main__.py", line 7, in <module>
sys.exit(main())
File "C:\Users\Vita\.local\pipx\venvs\steam-acolyte\lib\site-packages\steam_acolyte\app.py", line 88, in main
window = LoginDialog(steam, load_theme())
File "C:\Users\Vita\.local\pipx\venvs\steam-acolyte\lib\site-packages\steam_acolyte\window.py", line 40, in __init__
self.update_userlist()
File "C:\Users\Vita\.local\pipx\venvs\steam-acolyte\lib\site-packages\steam_acolyte\window.py", line 45, in update_userlist
users = sorted(self.steam.users(), key=lambda u:
File "C:\Users\Vita\.local\pipx\venvs\steam-acolyte\lib\site-packages\steam_acolyte\steam.py", line 188, in users
config = self.read_config('loginusers.vdf')
File "<decorator C:\Users\Vita\.local\pipx\venvs\steam-acolyte\lib\site-packages\steam_acolyte\steam.py>", line 1, in <lambda>
File "C:\Users\Vita\.local\pipx\venvs\steam-acolyte\lib\site-packages\steam_acolyte\util.py", line 85, in wrapper
return fn(obj, *args, **kwargs)
File "C:\Users\Vita\.local\pipx\venvs\steam-acolyte\lib\site-packages\steam_acolyte\steam.py", line 283, in read_config
text = read_file(conf)
File "C:\Users\Vita\.local\pipx\venvs\steam-acolyte\lib\site-packages\steam_acolyte\util.py", line 11, in read_file
return f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x91 in position 94: illegal multibyte sequence
The reason for this error is that the default string encoding for my region is CP936(also known as gbk). So the default encoding of the open method in python is gbk, but I turned on the "Use UTF-8 as global language support" feature, which caused the error.
In [1]: import locale; locale.getdefaultlocale()
Out[1]: ('zh_CN', 'cp936')
In [2]: import sys; sys.getdefaultencoding()
Out[2]: 'utf-8'
Plantform: Windows 10 x64 System encode: utf-8
I recently ran into a problem with the system default encoding when using steam-acolyte.
And here‘s the error log:
The reason for this error is that the default string encoding for my region is CP936(also known as gbk). So the default encoding of the
open
method in python is gbk, but I turned on the "Use UTF-8 as global language support" feature, which caused the error.