24

I have installed pylint via easy_install. I can run pylint <filename> with success. But pydev refuses to use it.

  • I checked "use pylint"
  • I configured correct path
  • I updated my python interpreter in eclipse to have pylit in pythonpath
  • I use Eclipse Galileo
  • I have build automatically checked
  • I tried cleaning whole project and no errors

What am I doing wrong?

Asclepius
  • 57,944
  • 17
  • 167
  • 143
Kugel
  • 19,354
  • 16
  • 71
  • 103
  • Having a similar problem now trying to get eclipse+pydev(w/pylint: astng0.20.0, common0.49.0, pylint0.18.0) on a new machine. But I get the following error: AttributeError: 'ASTNGManager' object has no attribute 'set_cache_size' – monkut Apr 08 '10 at 07:19
  • Cleaning and rebuilding the project was enough for me. (I had already added the source folder to PyDev-PYTHONPATH.) – smci Sep 14 '11 at 00:23

3 Answers3

36

I'm guessing you may need to mark the folder that contains your code as a source folder. You can do this under project properties.

  • Project->Properties->PyDev-PYTHONPATH
  • add relevant folders to the list of sources.
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
ariddell
  • 3,413
  • 34
  • 32
  • If it's helpful, this config is stored in .pydevproject. In my case, an auto-script was editing that file, breaking pylint. – mlissner Oct 29 '11 at 19:31
  • 1
    I have configured this though I had the same issue and I resolved by following this step: Pylint should run whenever the source is changed and built, but you can go to the menu Project -> Clean... to force the python script to be built and code checked by Pylint; Reference Source: http://goo.gl/SYg1yj – shahjapan Sep 05 '14 at 08:29
3

I've noticed that Pydev won't run Pylint on files with dashes (hyphens) the the filename; according to the Pydev devs, '-' is not a valid Python module name character, and it doesn't look like they intend to fix it:

http://sourceforge.net/tracker/index.php?func=detail&aid=1915426&group_id=85796&atid=577329

http://sourceforge.net/tracker/index.php?func=detail&aid=2888890&group_id=85796&atid=577332

As if nobody writes scripts in Python... Grumble grumble...

Doctor J
  • 5,974
  • 5
  • 44
  • 40
0

To provide an alternative solution, pylint can be used as an External Tool in Eclipse. This requires having previously installed the pylint package for a Python installation.

Remember to first have a pylintrc file somewhere where pylint can find it, failing which a "No config file found" error is printed. Typically I would touch pylintrc inside the project directory, and keep the file in version control. For reference, see pylint command-line options.

In Eclipse, select Run, External Tools, External Tools Configurations.... Click the toolbar button to create a New launch configuration. Configure as below or as desired:

  • Name: pylint
  • Location: ${system_path:pylint}
  • Working Directory: ${project_loc}
  • Arguments: --reports=n "${resource_loc}"

Remember to click inside an open file to switch focus to it before running the above external tool for it. Failing this, an error can occur.

The output of the external tool will by default be printed to the console.


Related: Setting up pep8 as an External Tool in Eclipse

Community
  • 1
  • 1
Asclepius
  • 57,944
  • 17
  • 167
  • 143