msherry / flycheck-pycheckers

Multiple syntax checker for Python in Emacs, using Flycheck
GNU General Public License v3.0
63 stars 23 forks source link

"Can't find source file" with tramp-mode #61

Open jussiviinikka opened 2 years ago

jussiviinikka commented 2 years ago

Hi,

everything seems to work nicely when working with local files but when I enable flycheck-mode on a file opened through tramp-mode on aws I'm getting this:

Suspicious state from syntax checker python-pycheckers: Flycheck checker python-pycheckers returned 1, but its output contained no errors: Traceback (most recent call last):
  File "/home/jussi/.emacs.d/straight/build/flycheck-pycheckers/bin/pycheckers.py", line 1274, in <module>
    main()
  File "/home/jussi/.emacs.d/straight/build/flycheck-pycheckers/bin/pycheckers.py", line 1227, in main
    raise RuntimeError("Can't find source file %s" % source_file_path)
RuntimeError: Can't find source file /ssh:some_server:/path_to_file/flycheck_file.py

Try installing a more recent version of python-pycheckers, and please open a bug report if the issue persists in the latest release.  Thanks!

This is what I have in config.el

(use-package flycheck-pycheckers
  :after flycheck
  :ensure t
  :init
  (with-eval-after-load 'flycheck
    (add-hook 'flycheck-mode-hook #'flycheck-pycheckers-setup)
    )
  (setq flycheck-pycheckers-checkers
    '(
      mypy3
      pyflakes
      )
    )
  )

I'm not sure if flycheck-pycheckers is the source of the problem or something else (...the whole config.el is a bit involved...), but is this supposed to work also on files opened over tramp-mode?

Thanks!

msherry commented 2 years ago

It looks like pycheckers is running locally on your machine, and trying to read files on the remote machine (/ssh:some_server:/path_to_file/flycheck_file.py). This isn't easy to solve, I think -- we could copy the file locally, or try to run pycheckers.py remotely, but either way has problems.

I'm happy to take suggestions (or PRs!) to fix this, but I'm not immediately sure what we can do.

rpgoldman commented 2 years ago

Of the two alternatives, it seems like the latter is the most feasible. I could imagine extending the configuration file to contain information on remotely running the checkers. Yes, that would require more set-up, but I can't see how to manage the first alternative.

If I get the time, I will see about a PR.