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

Issue #1

Open
A7Ahli opened this issue Dec 5, 2024 · 1 comment
Open

Issue #1

A7Ahli opened this issue Dec 5, 2024 · 1 comment

Comments

@A7Ahli
Copy link

A7Ahli commented Dec 5, 2024

When I run python main.py I get this error. I use python 3.9

C:\Discord Bots\auto-voice-channel>python main.py
Traceback (most recent call last):
File "C:\Discord Bots\auto-voice-channel\main.py", line 33, in
korean.read('language/ko_kr.ini')
File "C:\Program Files\Python39\lib\configparser.py", line 697, in read
self._read(fp, filename)
File "C:\Program Files\Python39\lib\configparser.py", line 1020, in _read
for lineno, line in enumerate(fp, start=1):
File "C:\Program Files\Python39\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 40: character maps to

@SuhJae
Copy link
Owner

SuhJae commented Dec 6, 2024

The issue arises because the configparser library is attempting to read a file that contains characters not encoded in the default encoding (likely Windows-1252 on your system). This results in a UnicodeDecodeError.

The easiest solution without tweaking your system is to Specify UTF-8 Encoding in the main.py as:

fallback_lang.read('language.ini', encoding='utf-8')
english.read('language/en_us.ini', encoding='utf-8')
korean.read('language/ko_kr.ini', encoding='utf-8')
chinese.read('language/zh_cn.ini', encoding='utf-8')

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

No branches or pull requests

2 participants