Hi and thank You for helping!
Overview
I run a Linux Container (Guest) on my Machine (Host). On this guest I installed python3. Too, there I have a file "test.py". I edit this file via Emacs Tramp, however the flycheck syntax checker is not working. I suspect this is due to a misconfigured variable "default-directory" on the guest.
Details
System
- Host: Ubuntu 18.04.4 LTS, GNU EMacs 28.0.50; Flycheck version: 32snapshot (package: 20200610.1809)
- Guest/Container: Ubuntu 20.04.1 LTS;
On the guest
File test.py:
print("hello world")
Terminal:
which pylint
#> /usr/local/bin/pylint
pylint test.py
#> test.py:1:0: C0114: Missing module docstring (missing-module-docstring)
#> ------------------------------------------------------------------
#> Your code has been rated at 5.00/10 (previous run: 5.00/10, +0.00)
So far, so good.
Host
On my host I open GNU EMacs and then tramp to /ssh:ubuntu@guest:/home/ubuntu/test.py"
on the guest. I am now in test.py
remotely. Hitting M-x flycheck-mode
.
First line shows this syntax error:
No module named /ssh:ubuntu@phd:/home/ubuntu/PHD/test.py [fatal]
No other syntax errors (of course). I further tried M-x flycheck-compile
with python-pylint
:
-*- mode: compilation; default-directory: #("/ssh:ubuntu@phd:/home/ubuntu/" 1 4 (helm-ff-file t) 5 11 (helm-ff-file t) 12 15 (helm-ff-file t)) -*-
Compilation started at Mon Aug 3 13:07:20
/usr/bin/python3 -c import\ sys\;sys.path.pop\(0\)\;import\ runpy\;runpy.run_module\(\"pylint\"\) --reports\=n --output-format\=json /ssh\:ubuntu\@phd\:/home/ubuntu/test.py
[
{
"type": "fatal",
"module": "/ssh:ubuntu@guest:/home/ubuntu/test.py",
"obj": "",
"line": 1,
"column": 0,
"path": "/ssh:ubuntu@guest:test.py",
"symbol": "fatal",
"message": "No module named /ssh:ubuntu@guest:test.py",
"message-id": "F0001"
}
]
Compilation exited abnormally with code 1 at Mon Aug 3 13:07:21
Same with python-pycompile
:
-*- mode: compilation; default-directory: #("/ssh:ubuntu@guest:/home/ubuntu/" 1 4 (helm-ff-file t) 5 11 (helm-ff-file t) 12 15 (helm-ff-file t)) -*-
Compilation started at Mon Aug 3 13:21:58
/usr/bin/python3 -m py_compile /ssh\:ubuntu\@guest\:/home/ubuntu/test.py
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.8/py_compile.py", line 218, in <module>
sys.exit(main())
File "/usr/lib/python3.8/py_compile.py", line 209, in main
compile(filename, doraise=True)
File "/usr/lib/python3.8/py_compile.py", line 142, in compile
source_bytes = loader.get_data(file)
File "<frozen importlib._bootstrap_external>", line 972, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/ssh:ubuntu@phd:/home/ubuntu/test.py'
Compilation exited abnormally with code 1 at Mon Aug 3 13:21:58
The output of flycheck-verify-setup
:
Syntax checkers for buffer test.py in python-mode:
First checker to run:
python-pylint
- may enable: yes
- executable: Found at /usr/bin/python3
- configuration file: Not found
- `pylint' module: Found at "/usr/local/lib/python3.6/dist-packages/pylint/__init__.py"
- next checkers: python-mypy
Checkers that could run if selected:
python-pycompile select
- may enable: yes
- executable: Found at /usr/bin/python3
- next checkers: python-mypy
Checkers that are compatible with this mode, but will not run until properly configured:
python-flake8 (automatically disabled) reset
- may enable: no
- executable: Found at /usr/bin/python3
- configuration file: Not found
- `flake8' module: Missing; sys.path is ['/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']
- next checkers: python-pylint, python-mypy
python-mypy (automatically disabled) reset
- may enable: no
- may run: t
- executable: Not found
- configuration file: Not found
Flycheck Mode is enabled. Use C-u C-c ! x to enable disabled checkers.
--------------------
Flycheck version: 32snapshot (package: 20200610.1809)
Emacs version: 28.0.50
System: x86_64-pc-linux-gnu
Window system: x
Hypothesis
I think just the default-dir variable pointing to test.py
is a misfit in this case. Maybe this is easy to fix and I just missed a point in the manual?
Help highly appreciated.
--
Flychecker is a terrific tool and I cannot imagine not using it - thank You!
/ssh:ubuntu@phd:/home/ubuntu/PHD/test.py
). This is a common error, one must use the local part of a file name only. If you want more debugging, I recommend to contacttramp-devel@gnu.org
, SX is not suited for this. – Michael Albinus Aug 3 '20 at 19:26