python-lsp / python-lsp-server

Fork of the python-language-server project, maintained by the Spyder IDE team and the community
MIT License
1.93k stars 194 forks source link

python 3.9 flake8 plugin doesn't work and throws error. #73

Open vikigenius opened 3 years ago

vikigenius commented 3 years ago

So I enabled the flake8 plugin as described in the CONFIGURATION.md

But opening a python files throws the following error and the plugin doesn't work.

2021-08-21 20:41:11,853 EDT - ERROR - pylsp.plugins.flake8_lint - Error while running flake8 'WARNING:flake8.checker:The --jobs option is not compatible with supplying input using - . Ignoring --jobs arguments.
Traceback (most recent call last):
  File "/home/void/Projects/Python/redcloud/.venv/bin/flake8", line 8, in <module>
    sys.exit(main())
  File "/home/void/Projects/Python/redcloud/.venv/lib/python3.9/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "/home/void/Projects/Python/redcloud/.venv/lib/python3.9/site-packages/flake8/main/application.py", line 363, in run
    self._run(argv)
  File "/home/void/Projects/Python/redcloud/.venv/lib/python3.9/site-packages/flake8/main/application.py", line 351, in _run
    self.run_checks()
  File "/home/void/Projects/Python/redcloud/.venv/lib/python3.9/site-packages/flake8/main/application.py", line 264, in run_checks
    self.file_checker_manager.run()
  File "/home/void/Projects/Python/redcloud/.venv/lib/python3.9/site-packages/flake8/checker.py", line 323, in run
    self.run_serial()
  File "/home/void/Projects/Python/redcloud/.venv/lib/python3.9/site-packages/flake8/checker.py", line 307, in run_serial
    checker.run_checks()
  File "/home/void/Projects/Python/redcloud/.venv/lib/python3.9/site-packages/flake8/checker.py", line 589, in run_checks
    self.run_ast_checks()
  File "/home/void/Projects/Python/redcloud/.venv/lib/python3.9/site-packages/flake8/checker.py", line 494, in run_ast_checks
    for (line_number, offset, text, _) in runner:
  File "/home/void/Projects/Python/redcloud/.venv/lib/python3.9/site-packages/flake8_plugin_utils/plugin.py", line 75, in run
    self._load_file()
  File "/home/void/Projects/Python/redcloud/.venv/lib/python3.9/site-packages/flake8_plugin_utils/plugin.py", line 87, in _load_file
    with open(self._filename, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'stdin'
'

Installing the 3rd party flake8 plugin pyls-flake8 does not fix the issue either.

chaoflow commented 3 years ago

@vikigenius With what editor do you see this? Are you still able to reproduce with latest versions of flake8 and pylsp? Using (doom) emacs and latest versions I can't reproduce.

vikigenius commented 3 years ago

The error seems to have gone now, but it doesn't actually seem to be using the plugin anymore.

So now if you install the pyls-flake8 plugin from https://github.com/emanspeaks/pyls-flake8/, you can see a different error which complains about incorrect flake8 usage