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

UnicodeDecodeError: 'gbk' codec can't decode byte 0xb2 in position 1972: illegal multibyte sequence #7

Closed
halfknife opened this issue Mar 22, 2024 · 2 comments

Comments

@halfknife
Copy link

image

Traceback (most recent call last):
File "D:\sd-webui-prompt-all-in-one-app\app.py", line 9, in
import gradio as gr
File "C:\Users\win10\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio_init_.py", line 3, in
import gradio._simple_templates
File "C:\Users\win10\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio_simple_templates_init_.py", line 1, in
from .simpledropdown import SimpleDropdown
File "C:\Users\win10\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio_simple_templates\simpledropdown.py", line 6, in
from gradio.components.base import FormComponent
File "C:\Users\win10\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio\components_init_.py", line 40, in
from gradio.components.multimodal_textbox import MultimodalTextbox
File "C:\Users\win10\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio\components\multimodal_textbox.py", line 28, in
class MultimodalTextbox(FormComponent):
File "C:\Users\win10\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio\component_meta.py", line 198, in new
create_or_modify_pyi(component_class, name, events)
File "C:\Users\win10\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio\component_meta.py", line 92, in create_or_modify_pyi
source_code = source_file.read_text()
File "C:\Users\win10\AppData\Local\Programs\Python\Python310\lib\pathlib.py", line 1135, in read_text
return f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xb2 in position 1972: illegal multibyte sequence

@xwxxwk
Copy link

xwxxwk commented Mar 22, 2024

将startup-windows.bat文件最后两行改为:
python -X utf8 install.py
python -X utf8 app.py


备用方法:
手动将Python310\lib\site-packages\gradio\component_meta.py文件中的read_text()替换为read_text(encoding="utf-8")

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Gradio’s problem seems to be something that can’t be fixed at the moment.

You can first manually replace read_text() in the Python310\lib\site-packages\gradio\component_meta.py file with read_text(encoding="utf-8")

I'm currently using it with no problem.

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

3 participants