简体   繁体   English

使用TOX运行Flake8测试时出现Unicode错误

[英]Unicode Error when running Flake8 test with TOX

I'm new to Tox and i want to set it up to run flake8 test on my project but i keep getting unicode error when i try to run tox. 我是Tox的新手,我想将它设置为在我的项目上运行flake8测试,但是当我尝试运行tox时,我一直收到unicode错误。

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

This is a peek of my tox.ini file: 这是我的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

Tox reads environment variables to get encoding information for your language. Tox读取环境变量以获取您的语言的编码信息。

You cant set it in terminal. 你不能在终端设置它。 (Write in .bashrc file to make it permanent) (写入.bashrc文件使其永久化)

export LANG=en_US.UTF-8

or pass it in tox.ini file 或者将其传递给tox.ini文件

setenv = LANG=en_US.UTF-8

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM