2017-04-13 128 views
2

我是Tox的新手,我想将它设置为在我的项目上运行flake8测试,但当我尝试运行tox时,我一直收到unicode错误。使用TOX运行Flake8测试时出现Unicode错误

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 76: ordinal not in range(128)

这是我tox.ini文件的窥视:

[tox] 
envlist = flake8 

[testenv:flake8] 
basepython = python2 
skip_install = true 
deps = 
    flake8 
commands = 
    flake8 -v 

# Flake8 Configuration 
[flake8] 
# Ignore some flake8-docstrings errors 
# NOTE(sigmavirus24): While we're still using flake8 2.x, this ignore line 
# defaults to selecting all other errors so we do not need select=E,F,W,I,D 
# Once Flake8 3.0 is released and in a good state, we can use both and it will 
# work well \o/ 
ignore = D203, E226, E302, E41 
exclude = 
    .tox, 
    .git, 
    __pycache__, 
    build, 
    dist, 
    *.pyc, 
    *.egg-info, 
    .cache, 
    .eggs 
max-complexity = 10 
import-order-style = google 
application-import-names = flake8 
+0

什么是终端'回声$ LANG'的输出?您使用的是哪个版本的毒品? –

+0

@RaviKumar'echo $ LANG'的输出是空的。我使用Tox 2.7.0 – proton

+0

你能在终端写'export LANG = en_US.UTF-8'后测试吗? –

回答

5

弓形体读取环境变量来获取你的语言编码信息。

你不能在终端中设置它。 (在.bashrc文件中写入使其永久)

export LANG=en_US.UTF-8 

或者通过它在tox.ini文件

setenv = LANG=en_US.UTF-8