Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jussiviinikka opened this issue Sep 16, 2021 · 2 comments
Open

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

jussiviinikka opened this issue Sep 16, 2021 · 2 comments

Comments

@jussiviinikka
Copy link

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
Copy link
Owner

msherry commented Sep 16, 2021

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.

  • copying files locally and running pycheckers over them will kind-of work for some checkers, but others (e.g. mypy) depend on context from the surrounding project files. Even simple linters can depend on config files in the repository, which we'd also have to copy over somehow.
  • running pycheckers remotely is difficult -- we don't necessarily have a sane environment in which to run. e.g., we can't depend on mypy, flake8, or whatever to be installed.

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

@rpgoldman
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants