psf / black

The uncompromising Python code formatter
https://black.readthedocs.io/en/stable/
MIT License
37.81k stars 2.4k forks source link

Reading config.cfg: Error reading configuration file: This float doesn't have a leading digit #900

Closed den4uk closed 5 years ago

den4uk commented 5 years ago

Operating system: Linux Python version: 3.7.1 Black version: 19.3b0 Does also happen on master: yes, checked!

My setup.cfg file contains the following line:

[bumpversion]
commit = True
current_version = 1.0.0

When black is pointed to read this config, the following error occurs:

$ black --config=setup.cfg --check --verbose src
Error: Could not open file setup.cfg: Error reading configuration file: This float doesn't have a leading digit (line 2 column 1 char 14)

I believe when it sees the version number it thinks it's a float, but encounters a second dot and fails parsing it as a float.

JelleZijlstra commented 5 years ago

Black doesn't support setup.cfg as config files. It tries to parse the file as TOML, and evidently it's not valid TOML.

danvip10 commented 4 years ago

Hi, I'm getting this same error when using a .flake8 configuration file. I also tried with a .toml, but it made no difference. Python version: 3.7.4 Black version: 19.10b0 Running Windows 10

The .flake8 file:

[flake8]
ignore = E203, E266, E501, W503
max-line-length = 80

The error message:

Error: Could not open file .flake8: Error reading configuration file: This float doesn't have a leading digit (line 2 column 1 char 9)