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

python3.6.16 docker中各种报编码问题 #29

Closed
lscgzwd opened this issue Nov 23, 2021 · 3 comments
Closed

python3.6.16 docker中各种报编码问题 #29

lscgzwd opened this issue Nov 23, 2021 · 3 comments

Comments

@lscgzwd
Copy link

lscgzwd commented Nov 23, 2021

读es.ini , 读sheetname.conf ,读excel文件,中文文件名都的报unicode错误,前两个我在读配置文件时候指定编码是utf-8解决了,excel这个指定编码都不行,最后是把文件改名了才解决

@lscgzwd
Copy link
Author

lscgzwd commented Nov 23, 2021

Traceback (most recent call last):
  File "write_vecs2bin.py", line 18, in <module>
    from bert_server.sentence_bert_server import SentenceBERT
  File "/src/bert_server/sentence_bert_server.py", line 19, in <module>
    faq_config.read(os.path.join(dir_name, "../config/befaq_conf.ini"))
  File "/usr/local/lib/python3.6/configparser.py", line 697, in read
    self._read(fp, filename)
  File "/usr/local/lib/python3.6/configparser.py", line 1015, in _read
    for lineno, line in enumerate(fp, start=1):
  File "/usr/local/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 34: ordinal not in range(128)

@lscgzwd
Copy link
Author

lscgzwd commented Nov 24, 2021

应该是python的官方docker容器没有locales, 中文语言包导致。还在尝试中

@lscgzwd
Copy link
Author

lscgzwd commented Nov 25, 2021

解决了。python容器需要手动安装下locales locales-all包

@lscgzwd lscgzwd closed this as completed Nov 25, 2021
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