安装和卸载 flake8 插件后出现错误。执行 --help 或 --version 时抛出的错误

Getting errors after installing & uinstalling flake8 plugins. Errors thrown when doing --help or --version

我今天在玩不同的 flake8 插件,在卸载其中一个并安装一个新插件后,flake8 --version 不再适合我。

我当时的 flake8 包是

(python3) $ flake8 --version 3.8.4 (flake8-bugbear: 20.11.1, mccabe: 0.6.1, naming: 0.11.1, pycodestyle: 2.6.0, pyflakes: 2.2.0) CPython 3.8.2 on Darwin

之后我有 运行

它现在因 flake8 --version

上的此错误而中断
(python3) $ flake8 --version
Traceback (most recent call last):
  File "/Users/dtan/code/python3/bin/flake8", line 8, in <module>
    sys.exit(main())
  File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/main/application.py", line 363, in run
    self._run(argv)
  File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/main/application.py", line 350, in _run
    self.initialize(argv)
  File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/main/application.py", line 332, in initialize
    self.parse_configuration_and_cli(
  File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/main/application.py", line 182, in parse_configuration_and_cli
    self.options, self.args = aggregator.aggregate_options(
  File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/options/aggregator.py", line 45, in aggregate_options
    parsed_config = config_parser.parse()
  File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/options/config.py", line 312, in parse
    return self.merge_user_and_local_config()
  File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/options/config.py", line 277, in merge_user_and_local_config
    config = self.parse_local_config()
  File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/options/config.py", line 240, in parse_local_config
    return self._parse_config(config)
  File "/Users/dtan/code/python3/lib/python3.8/site-packages/flake8/options/config.py", line 217, in _parse_config
    value = method(self.program_name, option_name)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/configparser.py", line 828, in getboolean
    return self._get_conv(section, option, self._convert_to_boolean,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/configparser.py", line 808, in _get_conv
    return self._get(section, conv, option, raw=raw, vars=vars,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/configparser.py", line 803, in _get
    return conv(self.get(section, option, **kwargs))
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/configparser.py", line 1163, in _convert_to_boolean
    raise ValueError('Not a boolean: %s' % value)
ValueError: Not a boolean: true # Print the source code generating the error/warning in question

我已经尝试卸载并重新安装 flake8,但没有成功。我认为文档内容有问题,因为 flake8 --help 也会抛出此错误

其中一个插件似乎添加了一个配置解析器并更改了其中一个 the configuration files。卸载时,解析器已被删除,但它保留了配置文件中的更改。

您需要 运行 查看所有 flake8 配置文件并删除已卸载插件的配置部分。