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

i18n error #356

Open
mark-wd opened this issue Oct 28, 2024 · 4 comments
Open

i18n error #356

mark-wd opened this issue Oct 28, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@mark-wd
Copy link

mark-wd commented Oct 28, 2024

Win11, local instance, latest version as of 28 Oct 2024.

I was getting the error below. Did a full reinstall and was still getting it. Console:

Use "faster-whisper" implementation Device "cuda" is detected Traceback (most recent call last): File "H:\Whisper-WebUI\app.py", line 483, in <module> app.launch() File "H:\Whisper-WebUI\app.py", line 232, in launch with self.i18n: File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 142, in __exit__ next(self.gen) File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio_i18n\i18n.py", line 330, in Translate translation_dict = yaml.safe_load(f) File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\__init__.py", line 125, in safe_load return load(stream, SafeLoader) File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\__init__.py", line 79, in load loader = Loader(stream) File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\loader.py", line 34, in __init__ Reader.__init__(self, stream) File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\reader.py", line 85, in __init__ self.determine_encoding() File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\reader.py", line 124, in determine_encoding self.update_raw() File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\yaml\reader.py", line 178, in update_raw data = self.stream.read(size) File "C:\Users\User\AppData\Local\Programs\Python\Python310\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 2456: character maps to <undefined> "launching the app" Press any key to continue .

Following the traceback, I went to my "AppData\Local\Programs\Python\Python310\Lib\site-packages\gradio_i18n" and found "i18n.py". I changed line 326 from "with open(translation, "r") as f:" to "with open(translation, "r", encoding="utf-8") as f:" and now the UI runs just fine.

You should account for this situation so that less technical users with certain locale settings don't run into this issue.

@mark-wd mark-wd added the bug Something isn't working label Oct 28, 2024
@jhj0517
Copy link
Owner

jhj0517 commented Oct 28, 2024

Hi. I thought I already fixed this in jhj0517/gradio-i18n and this shouldn't happen anymore.

"with open(translation, "r")

This line should be with open(translation, "r", encoding=find_encoding(translation)) if my patched version is installed properly.

Just for information, did you install the package manually via

pip install gradio-i18

Or did you install the packages with

pip install -r requirements.txt

Or just run install.bat?

@mark-wd
Copy link
Author

mark-wd commented Oct 28, 2024

I just ran "install.bat".

@mark-wd
Copy link
Author

mark-wd commented Oct 28, 2024

Well, first I updated after not having updated in a month via the updater bat. Then it broke. Then full uninstall and reinstall via the installer bat.

@jhj0517
Copy link
Owner

jhj0517 commented Oct 28, 2024

Well anyway, if you ran install.bat it should not have happened.
I hope hoveychen/gradio-i18n#2 is merged and fixed in the official package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants