4

I'm trying to install SublimeLinter-pylint into my Sublime Text 3. It tells me to follow instructions because it (presumably) can't find lint.py (I tried installing Pylinter before this and that went down the drain so I'm assuming it's the same problem).

I've already looked at the other answers to similar questions and they don't apply to me.

One says to use SublimeLinter, which I'm doing. I have it installed and the PHP/JS linters I have installed on top of it are working just fine.

Then it says to install pylint (duh) which I've already done using pip. For reference, pylint --version in Terminal prints:

No config file found, using default configuration
pylint 1.2.1, 
astroid 1.1.1, common 0.62.0
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 00:54:21) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]

So I'm a bit lost. Right now when I tried installing SublimeLinter via Package Control, it told me to follow installation instructions here. This tells me I have to follow the instructions provided here. I've done as told, and 'hash - r which pylint' just prints nothing. No path, no error, no "module not found", just blank. 'hash - r which asdfjkl' will give an error, though, so that's working as far as I can tell and pylint is also working, as I verified with a python file.

Never has anything relating to ST3 been so confusing and annoying; I've pretty much given up on this and will proceed without a linter (it's python so at least debugging isn't that bad).

Any suggestions?

djbhindi
  • 364
  • 3
  • 13

2 Answers2

4

I think you just need to type

which pylint

You should see something like

/usr/bin/pylint

not sure what hash -r is supposed to do

P4ul
  • 770
  • 5
  • 15
2

I dealt with a similar issue configuring SublimeLinter's pylint plugin. From the output of pylint --version I see that you installed the py3 version of pylint (presumably via pip3 install pylint or similar).

By default SublimeLinter is looking for the py2 version of pylint. If you installed the py2 version of pylint right now (i.e. pip2 install pylint), it would probably work. Anyways, in general it is important that you use the appropriate version of pylint for the code you will be writing, otherwise you'll get erroneous lint reports.

In theory, the pylint plugin should be able to detect this. And in the event that it doesn't, you're supposed to edit SublimeLinter's settings and add a python meta setting to indicate the requested version of python (i.e. "@python": 3.4). See the documentation @ https://sublimelinter.readthedocs.org/en/latest/meta_settings.html#python-meta-setting.

In reality, the SublimeLinter-pylint is currently really screwy with all this. The SublimeLinter plugin probably shoulders most of the blame however. See issues @ https://github.com/SublimeLinter/SublimeLinter-pylint/issues/12.

I did notice that SublimeLinter-pylint seemed to work well when both versions of pylint are installed. Other people in support forums have had similar success with this. Of course there can only be one pylint binary in the same bin folder, but that's ok.

I ran the following:

pip2 install --user -I pylint
pip3 install --user -I pylint

Also, FYI hash is used to search for commands on the PATH. For example, hash python && echo true || echo false will print true. Similarly, hash wackpython && echo true || echo false will print false.

If you sudo rm /usr/bin/python to delete python and immediately run type python && echo true || echo false it will print true because python is still hashed to /usr/bin/python.

After deleting python if you instead run hash -r then type python && echo true || echo false, it will print false. That is because hash -r dumped all the remembered locations.

I'm not entirely sure why you were instructed to execute hash -r, but rest assured that no output is the expected output.

Six
  • 5,122
  • 3
  • 29
  • 38