簡體   English   中英

使用TOX運行Flake8測試時出現Unicode錯誤

[英]Unicode Error when running Flake8 test with TOX

我是Tox的新手,我想將它設置為在我的項目上運行flake8測試,但是當我嘗試運行tox時,我一直收到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

Tox讀取環境變量以獲取您的語言的編碼信息。

你不能在終端設置它。 (寫入.bashrc文件使其永久化)

export LANG=en_US.UTF-8

或者將其傳遞給tox.ini文件

setenv = LANG=en_US.UTF-8

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM