Help: pylint does not work with Emacs23

I am trying to use Pylint with Emacs on Windows XP. My version of Emacs is EmacsW32 23.1, pylint is 0.21.3 with Python 2.5. After easy_install pylint, I added the following lines to the Emacs init file copied to the Emacs Wiki.

When I call flymake mode in a .py file, I see how flymake starts syntax checking, the status of the mode is changed to flymake *, and then returns via flymake in a few seconds. But no error is reported and no syntax error is highlighted .

I tried using pylint on the command line, and it works with the command "pylint test.py" , reporting syntax errors in a single file.

I even tried to clear the .emacs file, but that does not help.

Can someone help me with this? Thank you very much.

(when (load "flymake" t) (defun flymake-pylint-init () (let* ((temp-file (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace)) (local-file (file-relative-name temp-file (file-name-directory buffer-file-name)))) (list "epylint" (list local-file)))) (add-to-list 'flymake-allowed-file-name-masks '("\\.py\\'" flymake-pylint-init))) 

Question update: On the command line, I tried the following: "pylint" and "epylint". Does this mean that the epilint has a problem?

 C:\Projects>pylint test_lib.py No config file found, using default configuration ************* Module test_lib E: 13: invalid syntax C:\Projects>epylint test_lib.py 'test_lib.py':1: [F] No module named 'test_lib.py' C:\Projects>epylint Traceback (most recent call last): File "C:\Python25\Scripts\epylint", line 5, in <module> pkg_resources.run_script('pylint==0.21.3', 'epylint') File "C:\Python25\Lib\site-packages\pkg_resources.py", line 489, in run_script self.require(requires)[0].run_script(script_name, ns) File "C:\Python25\Lib\site-packages\pkg_resources.py", line 1207, in run_script execfile(script_filename, namespace, namespace) File "c:\python25\lib\site-packages\pylint-0.21.3-py2.5.egg\EGG-INFO\scripts\epylint", line 3, in <module> epylint.Run() File "c:\python25\lib\site-packages\pylint-0.21.3-py2.5.egg\pylint\epylint.py", line 93, in Run lint(sys.argv[1]) IndexError: list index out of range 
+4
source share
3 answers

The program called flymake should return 0 errorlevel, otherwise flymake thinks that there are problems when calling subprocesses.

Reading this answer and these corrections , I managed to start flymake with a peel:

On Windows, but you can do the same in Un * x, I created the pycheckers.bat batch file (available in your PATH):

 pylint -f parseable -rn --disable=C,R,I %1 %2 %3 %4 %5 %6 %7 %8 %9 exit /b 0 

In my .emacs, I put these lines:

 (when (load "flymake" t) (defun flymake-pyflakes-init () (let* ((temp-file (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace)) (local-file (file-relative-name temp-file (file-name-directory buffer-file-name)))) (list "pycheckers" (list local-file)))) (add-to-list 'flymake-allowed-file-name-masks '("\\.py\\'" flymake-pyflakes-init))) 

Now when I open the .py file, I do Mx flymake-mode to activate it. Flymake detects python errors and warnings without any problems.

Please note that you can add other tools to the pycheckers.bat file.

+3
source

I use emacs22-nox for linux, so you may need google "font-lock-mode" to figure out how to do this on your computer. First enter the emacs command line by pressing Esc+x . Now you can enter the font lock mode and press enter (the command line is at the bottom of the screen). I had the same problem on the same server of my clients. Their emacs did not enable font lock mode by default. Hope this helps.

0
source

Here are my two cents ...

 (defun flymake-pylint-init () (list python-python-command (list "-m" "pylint.lint" "-f" "parseable" buffer-file-name))) (add-to-list 'flymake-allowed-file-name-masks '("\\.py\\'" flymake-pylint-init)) 

tested on WinXP, Linux, OS-X.

0
source

All Articles