Tag: unicode

POSIX语言环境,UnicodeDecodeError

打开Docker实例(例如, docker run -ti ubuntu:16.04 ),创buildPython文件a.py # -*- coding: utf-8 -*- a = 'ö' 和r.py with open('a.py') as f: exec(f.read()) 在执行python r.py ,全是文件。 当使用python3 ,但是,一个可怕的 Traceback (most recent call last): File "r.py", line 2, in <module> exec(f.read()) File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position […]

Docker中的Python无法在不使用–tty的情况下打印unicode

我试图在Docker中运行一个简单的Python应用程序,使用官方的python:2.7图像。 我的问题是,除非在–tty docker run启用-t / –tty ,python print命令在尝试打印Unicode字符时终止: UnicodeEncodeError: 'ascii' codec can't encode characters… 如果我启用–tty它工作没有错误。 问题是我想要在后台运行这个进程,使用–detach ,那个模式不支持–tty 。 需要对我的Dockerfile进行什么样的更改,以便在尝试打印Unicodestring时不会终止? 最小的Dockerfile: FROM python:2.7 CMD [ "python", "-c", "print (u'\\xc1')" ] 最小的运行命令: # error docker run myimage # working docker run –tty myimage 注意:它也可以在官方的python:3.5映像中正常工作。

erl中的Ctrl + G不起作用

我试图互连erlang节点,但inputCtrl + G不起作用: Eshell V6.4.1 (abort with ^G) 1> ^G Eshell V6.4.1 (abort with ^G) 1> ^G Eshell V6.4.1 (abort with ^G) 1> ^G Eshell V6.4.1 (abort with ^G) 任何想法为什么会发生? 我正在考虑区域设置,将其更改为UTF-8: LANG=en_US.UTF-8 LANGUAGE=en_US.utf8 LC_CTYPE="en_US.utf8" LC_NUMERIC="en_US.utf8" LC_TIME="en_US.utf8" LC_COLLATE="en_US.utf8" LC_MONETARY="en_US.utf8" LC_MESSAGES="en_US.utf8" LC_PAPER="en_US.utf8" LC_NAME="en_US.utf8" LC_ADDRESS="en_US.utf8" LC_TELEPHONE="en_US.utf8" LC_MEASUREMENT="en_US.utf8" LC_IDENTIFICATION="en_US.utf8" LC_ALL=en_US.utf8 任何想法为什么会发生? 一切都在docker集装箱内完成。

在构buildDocker容器时python3中的Mysterious UnicodeDecodeError

我正在创build一个python 3应用程序。 https://github.com/Omrigan/TED-analysis 部署我想要在我的Github仓库的根目录中使用Docker和Dockerfile(你可以检查它)。 所以,当我做“dockerbuild造”。 我在这行上得到一个错误: RUN pip3 install –upgrade -r /root/ted_talks/requirements.txt 从控制台login: Collecting httpretty==0.8.10 (from smart-open>=1.2.1->gensim->-r /root/ted_talks/requirements.txt (line 4)) Downloading httpretty-0.8.10.tar.gz (41kB) Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-em459e9u/httpretty/setup.py", line 86, in <module> version=read_version(), File "/tmp/pip-build-em459e9u/httpretty/setup.py", line 46, in read_version finder.visit(ast.parse(local_file('httpretty', […]