Unicode Error when running Flake8 test with TOX

雨燕双飞 提交于 2020-01-02 07:12:21

问题


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.

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]
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

回答1:


Tox reads environment variables to get encoding information for your language.

You cant set it in terminal. (Write in .bashrc file to make it permanent)

export LANG=en_US.UTF-8

or pass it in tox.ini file

setenv = LANG=en_US.UTF-8


来源:https://stackoverflow.com/questions/43384822/unicode-error-when-running-flake8-test-with-tox

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!