flake8-return icon indicating copy to clipboard operation
flake8-return copied to clipboard

Plugin crashes when used with stdin

Open gorrog opened this issue 3 years ago • 2 comments

  • Date you used flake8-return: 27-11-2020
  • flake8-return version used, if any: 1.1.2
  • Python version, if any: Python 3.86
  • Operating System: Ubuntu 20.4

Description

When emacs' lsp-mode calls flake 8 on a file (in order to lint it), the command errors out. I strongly suspect the issue is the same as the one reported here: https://github.com/sco1/flake8-annotations/issues/52 My reason for suspecting the error lies within this plugin is the fact that the error goes away when I remove this plugin.

What I Did

Opened the file, activated the virtual env, and started the language server (which called flake8)

What I expected

Flake8 gives results and the pyls lints my code

What I got

Stack trace below

2020-11-27 12:43:25,280 UTC - ERROR - pyls.plugins.flake8_lint - Error while running flake8 'Traceback (most recent call last):
  File "some_code/.venv/bin/flake8", line 8, in <module>
    sys.exit(main())
  File "some_code/.venv/lib/python3.8/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "some_code/.venv/lib/python3.8/site-packages/flake8/main/application.py", line 363, in run
    self._run(argv)
  File "some_code/.venv/lib/python3.8/site-packages/flake8/main/application.py", line 351, in _run
    self.run_checks()
  File "some_code/.venv/lib/python3.8/site-packages/flake8/main/application.py", line 264, in run_checks
    self.file_checker_manager.run()
  File "some_code/.venv/lib/python3.8/site-packages/flake8/checker.py", line 323, in run
    self.run_serial()
  File "some_code/.venv/lib/python3.8/site-packages/flake8/checker.py", line 307, in run_serial
    checker.run_checks()
  File "some_code/.venv/lib/python3.8/site-packages/flake8/checker.py", line 589, in run_checks
    self.run_ast_checks()
  File "some_code/.venv/lib/python3.8/site-packages/flake8/checker.py", line 494, in run_ast_checks
    for (line_number, offset, text, _) in runner:
  File "some_code/.venv/lib/python3.8/site-packages/flake8_plugin_utils/plugin.py", line 75, in run
    self._load_file()
  File "some_code/.venv/lib/python3.8/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'
'

gorrog avatar Nov 27 '20 10:11 gorrog

ref https://github.com/afonasev/flake8-plugin-utils/issues/47

ddelange avatar Jan 16 '21 10:01 ddelange

Thank you for issue. Unfortunately, I can't fix it quickly, but I'm ready to consider a pull request.

afonasev avatar Aug 29 '22 07:08 afonasev