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

执行:python index.py zh ../data/dureader.para test_index 报UnicodeDecodeError错 #107

Open
jamyriver opened this issue Jun 8, 2023 · 1 comment

Comments

@jamyriver
Copy link

image

执行:python index.py zh ../data/dureader.para test_index
报错:
****\anaconda3\envs\my_paddlenlp\lib\site-packages\pkg_resources_init_.py:121: DeprecationWarning: pkg_resources is deprecated as an API
warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
****\anaconda3\envs\my_paddlenlp\lib\site-packages\pkg_resources_init_.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('mpl_toolkits').
Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
****\anaconda3\envs\my_paddlenlp\lib\site-packages\pkg_resources_init_.py:2870: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('google').
Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
Traceback (most recent call last):
File "index.py", line 41, in
for line in open(data_file):
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 4: illegal multibyte sequence

@jamyriver
Copy link
Author

自己解决了,
把 index.py 的 41 行改为:for line in open(data_file,"r", encoding="UTF-8", errors="ignore"):

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

1 participant