1

I just installed pylint from source, and can't get epylint to work when called from within emacs. It works fine when called from the command line.

In my .emacs file, I've defined a 'pylint' function as follows:

(defun pylint ()
  (interactive)
  (compile (concat "epylint " buffer-file-name)))

When I run M-x pylint from within emacs, I get the following error:

-*- mode: compilation; default-directory: "~/projects/external/pylearn2/pylearn2/scripts/papers/maxout/tests/" -*-
Compilation started at Sun Sep 14 15:54:49

epylint /home/mkg/projects/external/pylearn2/pylearn2/scripts/papers/maxout/tests/test_model.py
Warning: option include-ids is deprecated and ignored.
Warning: option symbols is deprecated and ignored.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/lint.py", line 1085, in 
    Run(sys.argv[1:])
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/lint.py", line 1025, in __init__
    linter.check(args)
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/lint.py", line 608, in check
    self.check_astroid_module(astroid, walker, rawcheckers, tokencheckers)
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/lint.py", line 685, in check_astroid_module
    walker.walk(astroid)
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 847, in walk
    self.walk(child)
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 847, in walk
    self.walk(child)
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 847, in walk
    self.walk(child)
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 847, in walk
    self.walk(child)
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 847, in walk
    self.walk(child)
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 847, in walk
    self.walk(child)
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 844, in walk
    cb(astroid)
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/checkers/typecheck.py", line 282, in visit_getattr
    confidence=confidence)
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/checkers/__init__.py", line 97, in add_message
    self.linter.add_message(msg_id, line, node, args, confidence)
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 401, in add_message
    (path, module, obj, line or 1, col_offset or 0), msg, confidence))
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/reporters/text.py", line 61, in handle_message
    self.write_message(msg)
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/reporters/text.py", line 51, in write_message
    self.writeln(msg.format(self._template))
  File "/usr/local/lib/python2.7/dist-packages/pylint-1.3.0-py2.7.egg/pylint/utils.py", line 105, in format
    return template.format(**dict(zip(self._fields, self)))
KeyError: u'path'
************* Module test_model

Compilation exited abnormally with code 1 at Sun Sep 14 15:54:53

For those who are curious: I'm not using Ubuntu's pylint package anymore because Ubuntu 13.10's pylint is out of date and still contains a bug which makes it useless for use with numpy.

Any suggestions would be much appreciated.

SuperElectric
  • 17,548
  • 10
  • 52
  • 69
  • It's possible emacs is missing an environment variable that is included in your shell. Try starting emacs from within your shell and running the command. – dgtized Sep 14 '14 at 19:19
  • @dgtized Yep, tried that, but nothing changed. – SuperElectric Sep 14 '14 at 19:39
  • What version of python is it using outside of emacs versus inside of it? I know one of the modes pays attention to virtualenv? – dgtized Sep 14 '14 at 19:44
  • @dgtized I tried running M-x run-python in emacs, and got python 2.7.5. This is the same version I get when running python from a shell. – SuperElectric Sep 14 '14 at 20:22
  • 1
    this is a bug that has been introduced by pylint 1.3. It's easily reproducible by using **epylint** on the command line (not **pylint**). It should be reported in https://bitbucket.org/logilab/pylint/issues – sthenault Sep 15 '14 at 07:43
  • @sthenault done: https://bitbucket.org/logilab/pylint/issue/339/epylint-crashes-in-pylint-130 – SuperElectric Sep 15 '14 at 13:12

0 Answers0