运行黑色会导致错误“此浮标没有领先的数字”。
当我尝试使用black a_file.py.py
在我的python项目的特定文件上运行黑色时,我会收到以下错误:
Error reading configuration file: This float doesn't have a leading digit (line 19 column 1 char 205)
下面是我的pyproject.toml文件:
[tool.black]
line-length = 88
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| buck-out
| build
)/
'''
[flake8]
max-line-length = 88
max-complexity = 18
select = B, C, E, F, W, T4, B9
ignore = E203, E266, E501, W503, F403, F401
如何解决此问题?
When I try to run black on a specific file of my python project using black a_file.py
, I get the following error:
Error reading configuration file: This float doesn't have a leading digit (line 19 column 1 char 205)
Below is my pyproject.toml file:
[tool.black]
line-length = 88
include = '\.pyi?
How can I fix this issue?
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| buck-out
| build
)/
'''
[flake8]
max-line-length = 88
max-complexity = 18
select = B, C, E, F, W, T4, B9
ignore = E203, E266, E501, W503, F403, F401
How can I fix this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是您使用错误语法的
pyproject.toml
文件的问题。例如,select = b,c,e,f,w,t4,b9
之类的行是ini-syntax - 在toml中,等效的是select =“ b,c,c, e,f,w,t4,b9“
或select = [“ b”,“ c”,“ e”,“ f”,“ w”,“ w”,“ t4”,“ b9”]] < /代码>。
但是,
flake8
尚未支持pyproject.toml
首先。只需从文件中删除其配置即可。
This is an issue of your
pyproject.toml
file using incorrect syntax. For example, a line such asselect = B, C, E, F, W, T4, B9
is INI-syntax – in TOML the equivalent would beselect = "B, C, E, F, W, T4, B9"
orselect = ["B", "C", "E", "F", "W", "T4", "B9"]
.However,
flake8
does not yet supportpyproject.toml
to begin with. Simply remove its configuration from the file.