Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Pylint working, linter-pylint not #2

Closed
magandrez opened this issue May 30, 2014 · 34 comments
Closed

Pylint working, linter-pylint not #2

magandrez opened this issue May 30, 2014 · 34 comments

Comments

@magandrez
Copy link

Hi,

I've installed linter and linter-pylint on my environment (Atom 0.100) but seems not to be working at all and I cannot find any log whatsoever. I'm running python 2.7.5 on a Mac OS X 10.9.3 and pylint 1.2.1

@magandrez
Copy link
Author

I found the console log. The error is on line 25 of linter-pylint.coffee file. Could it be the regex that matches the pylint version the problem?

/pylint ([\d\.]+)\,/

@hd-deman
Copy link
Member

@florianb, can you check it?

@florianb
Copy link
Contributor

florianb commented Jun 2, 2014

@magandrez, @hd-deman - i'll take a look

@florianb
Copy link
Contributor

florianb commented Jun 2, 2014

Hi @magandrez - please take a look into the console (ctrl + alt + i) and watch for log-entries beginning with Linter-Pylint:. It would help me to locate any errors if you could post a copy of the output.

To clarify, before the linter is getting started, the pylint-plugin tries to call pylint. If it can extract the version-number from the output, the linter gets started. Otherwise pylint seems not to be working correct and linter-pylint is set inactive to avoid a massive error-log-output.

@magandrez
Copy link
Author

Hi @florianb

Pylint seems to load:

Linter-Pylint: activation completed.

After this the editor finishes loading.

Then I open a new (Python) file, Pylint loads again and next entry is the following:

Linter-Pylint: 'pylint' was not executable on linter-pylint.coffee line 25

Hope it helps.

Manuel

@florianb
Copy link
Contributor

florianb commented Jun 2, 2014

Thank you for the detailed report, Manuel - i'll investigate that behaviour.. :) I'm sorry for any inconveniences.

@florianb
Copy link
Contributor

florianb commented Jun 2, 2014

Oh @magandrez - you could do me one last favour. Please post your output of pylint --version.

@magandrez
Copy link
Author

Sure @florianb no problem. Thank you for the support!. I am fairly new to Python ecosystem and Atom, so sorry if I cannot be of more help. Here is the output:

No config file found, using default configuration
pylint 1.2.1,
astroid 1.1.1, 
common 0.61.0
Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]

@florianb
Copy link
Contributor

florianb commented Jun 3, 2014

@magandrez - i wasn't able to reproduce the bug yet. I revisited the complete package-loading structure (which works fine for my testfiles - and my environment is exactly like yours) - therefore i fixed a bug on the debug-output and added the project-environment to the execution.

After the publishing of #3 (which should be introduced as v0.1.1) i would like to ask you again, posting me the output of the Linter-Pylint: 'pylint' was not executable-line.

Thanks for your patience. 🍓

@florianb
Copy link
Contributor

florianb commented Jun 6, 2014

@magandrez - the new version is published. It would be very nice, if you could check again the error while opening your python-file and post the corresponding error-message.
🍺

@magandrez
Copy link
Author

That was fast @florianb Thanks!

The output now is Linter-Pylint: 'pylint' was not executable: #127: stderr: /bin/sh: pylint: command not found. My pylint is installed in /usr/local/bin and that location is in my PATH.

@florianb
Copy link
Contributor

@magandrez - thanks a lot. It seems like the PATH-environment is somehow not recognized correctly. I'll dig in deeper but assume that there are less choices i can take to solve that problem in general.

@Argon-
Copy link

Argon- commented Jun 21, 2014

I'm stuck at the same problem.
I suspect it has to the with Atom being a GUI application, therefore 'seeing' only the environment from /etc/paths.d (at least on 10.9). Launching Atom from the command line supplies the whole path to the application, therefore it works in this case.

@magandrez
Copy link
Author

@Argon- Actually, when opening a Python file in Atom from the command line I get this: Uncaught TypeError: Object #<LinterPylint> has no method 'getCmd' in linter-pylint.coffee line 35. @florianb does this ring any bell?

@Argon-
Copy link

Argon- commented Jun 22, 2014

@magandrez There's a separate issue for that: #4
But yes, I get the same error. That's basically the "next" problem, once your pylint is visible for Atom.

@Argon-
Copy link

Argon- commented Jun 22, 2014

Follow up: a user could fix this issue for himself by including the paths in his PATH variable in /etc/paths.d to make them visible for GUI applications.
But tbh I'd recommend not doing that. A lot of GUI applications expect a clean, standard OSX environment, with the python, perl, ruby etc. versions OSX was shipped with.

@iszla
Copy link

iszla commented Jul 3, 2014

Same issue here. pep8 lint is working but pylint is not.
Linter-Pylint: 'pylint' was not executable: #127: stderr: /bin/sh: pylint: command not found linter-pylint.coffee:28
Also added a path to paths.d still no luck.

@svagi
Copy link

svagi commented Jul 6, 2014

Exactly same problem as @iszla.

@Calimero92
Copy link

I had the same error.
I'm on windows, withon python 2.7 64bits.
I get around it by changing line 27 of file linter-pylint.coffee.
replace:
versionRegEx = /pylint ([\d.]+),/
by
versionRegEx = /pylint-script.py ([\d.]+),/

not sure why, maybe it is linked to Windows Vs other system??

I will let the real develloper figure it out.

@idoziru
Copy link

idoziru commented Jul 12, 2014

Hi everybody.

I use Win7, Python3.3 and i got such problem too, but i fixed it.

In .atom\packages\linter-pylint\lib\linter-pylint.coffee in line #23

Change this

versionRegEx = /pylint ([\d\.]+)\,/  

for this

versionRegEx = /pylint-script.py ([\d.]+)\,/

And everything will be 👌

@dmnd
Copy link
Member

dmnd commented Jul 29, 2014

Windows users, I suspect your issue is different from the one that @magandrez was having. I created #13 to track the pylint-script.py problem. Please continue discussion there, and if one of you wants to submit a PR I'd be grateful.

@magandrez, now that the issue with getCmd is fixed, are you still having problems? If so, please reply and I'll re-open this issue.

@dmnd dmnd closed this as completed Jul 29, 2014
@magandrez
Copy link
Author

Hi @dmnd
I updated linter-pylint to the last version as well as linter and Atom, and found the following.

When opened from the OSX GUI (ie: launching Atom with Quicksilver, opening it from Applications folder, etc), I found the following error when opening a Python file Linter-Pylint: 'pylint' was not executable: #127: stderr: /bin/sh: pylint: command not found.

However, when launching Atom from the Terminal and I open a Python file, I don't receive any error messages (Linter-Pylint: found pylint 1.2.1), but when I play around with the python file, linter seems not to work.

The first issue seems related to the PATH environment. But I have no clue about the second one (linter not responding when I type errors in a python file), since there is no error log.

@dmnd
Copy link
Member

dmnd commented Aug 4, 2014

Thanks @magandrez. I added steelbrain/linter#150 to track the issue with PATH - that's good information and I bet it's behind a lot of the issues that are opened.

With regards to the second issue, can you go to settings for linter and turn on lint debug?

image

That will make your console noisy, but you'll be able to tell if pylint is running on your file and also see some error messages if they're present. Hopefully that gives us a clue what is wrong. I'll reopen this issue since you are still having problems that seem specific to pylint!

@dmnd dmnd reopened this Aug 4, 2014
@dmnd dmnd added needs info and removed needs info labels Aug 4, 2014
@magandrez
Copy link
Author

Hi again @dmnd

I hope I can bring some more information with this debug. First of all, I updated Linter to the last version released few hours ago (0.5.1). Here are my findings after debugging.

  • My setup is the following:
pylint 1.2.1, 
astroid 1.1.1, common 0.61.0
Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]
  • I launched Atom from the terminal and opened this file to test Linter-pylint.
  • This is the debug log straight from the console. I found odd the first two lines after pylint is initialized.
command and arguments ["pylint", "--msg-template='{line},{column},{category},{msg_id}:", "{msg}'", "--reports=n", "/var/folders/yv/jbqbhrtn3zlgmwglqkm1q5nw0000gn/T/11474-2663-zxvmydsource.python"]
command and arguments ["pylint", "--msg-template='{line},{column},{category},{msg_id}:", "{msg}'", "--reports=n", "/var/folders/yv/jbqbhrtn3zlgmwglqkm1q5nw0000gn/T/11474-2663-zxvmydsource.python"]

@dmnd
Copy link
Member

dmnd commented Aug 9, 2014

Those lines look a little odd to me, but not that bad. It's weird that {msg} is split off from the rest of the msg-template but it seems that gets undone (sigh) by linter-pylint.coffee:44.

You're getting an exception from pylint itself, so try running it by itself:

pylint --msg-template='{line},{column},{category},{msg_id}: {msg}' --reports=n test_file.py

Here's what happens on my system:

$ pylint --version
No config file found, using default configuration
pylint 1.3.0, 
astroid 1.2.0, common 0.62.1
Python 2.7.5 (default, Nov  1 2013, 17:18:30) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)]


$ pylint --msg-template='{line},{column},{category},{msg_id}: {msg}' --reports=n hello.py
No config file found, using default configuration
************* Module hello
25,0,warning,W0311: Bad indentation. Found 2 spaces, expected 4
26,0,warning,W0311: Bad indentation. Found 4 spaces, expected 8
27,0,warning,W0311: Bad indentation. Found 2 spaces, expected 4
28,0,warning,W0311: Bad indentation. Found 4 spaces, expected 8
29,0,warning,W0311: Bad indentation. Found 2 spaces, expected 4
33,0,warning,W0311: Bad indentation. Found 6 spaces, expected 4
23,0,convention,C0111: Missing function docstring

Does that work? If it doesn't, it seems like we have a problem with the way Atom is shelling out to pylint in which case maybe that split argument list is the problem.

@dmnd
Copy link
Member

dmnd commented Aug 9, 2014

You can also try this StackOverflow answer to attempt to fix the ValueError: unknown locale: UTF-8 error itself.

@magandrez
Copy link
Author

Hummm,

Well, I cannot see the problem. I've run the same command and I get the same response in the command line, however Atom does not lint at all any Python document.

Any suggestion where to go from here?

About the ValueError: thanks, I got that fixed now.

@dmnd
Copy link
Member

dmnd commented Aug 20, 2014

@magandrez can you try the latest version again? I suspect #15 may solve your issue.

If it doesn't can you please provide another lot of console output with debug mode on like you did here? Maybe something has changed now that you've resolved that ValueError thing.

Also, make sure you are using React editor. The old editor is deprecated.

@magandrez
Copy link
Author

@dmnd Progress!

I've made some progress. I've updated to the latest version (both Atom and pylint) and tested following the settings you mentioned and on safe mode. Yes, I should have done that before, sorry! :(

The result was no error messages from pylint. The problem was with a non-related package I installed and was causing the following error that I totally missed:

TypeError: Cannot read property 'indexOf' of undefined at /Users/spav/.atom/packages/tasks/lib/tasks.coffee:112:14

This error appeared when Atom was launched and for some reason did not allow the linter to show any output when I was modifying a Python sample file.

Now...What is the development status? Should I see some kind of error next to the line number if I modify a sample file? Or should I check the Developer Console for errors? Because I don't see any error

Thanks a lot!

@dmnd
Copy link
Member

dmnd commented Aug 31, 2014

atom --safe will cause the linter not to be loaded and you won't see any messages. Try uninstalling that other package, then run it again. If it doesn't work, post the console output here.

@magandrez
Copy link
Author

Oh well, seems we are back at the issue 150 with Linter (steelbrain/linter#150)
The output:

Linter-Pylint: 'pylint' was not executable: #127: stderr: /bin/sh: pylint: command not found
LinterPylint.executionCheckHandler

I believe the original bug is then closed and the problem remains with that issue I linked above.

@dmnd
Copy link
Member

dmnd commented Aug 31, 2014

ok @magandrez I'll close this issue. Sorry it's so tough to get this working 😧

You should be able to work around steelbrain/linter#150 by starting Atom from the terminal with atom. If you use virtualenv you'll need to start Atom from a terminal window that has the correct virtuanenv activated too.

@dmnd dmnd closed this as completed Aug 31, 2014
@shanereid
Copy link

Incase people are having this problem still, you can make a user-side temporary fix with a simple symbolic link, for pylint I just did so and all was working fine:

sudo ln -s /usr/local/bin/pylint /usr/bin/pylint

Obviously not the prettiest, however it does solve the problem until there's a fix on the plugin.

@ricardoquesada
Copy link

I had this problem and I found my problem. Basically I was using google's depot tools, which they include pylint and they were in the path before anything else.

there are two problems here:

  • I didn't want to use pylint, but since pylint was in the path (and "incorrect" path), atom was raising the error.
  • In case you want to use pylint, you need to install it using pip install pylint and make sure it is in the path before depot tools

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests