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

linting fails when .pylintrc is present #236

Closed
dtenenba opened this issue Dec 16, 2017 · 6 comments
Closed

linting fails when .pylintrc is present #236

dtenenba opened this issue Dec 16, 2017 · 6 comments
Labels

Comments

@dtenenba
Copy link

dtenenba commented Dec 16, 2017

I have a .pylintrc file that works just fine when I use the command line:

pylint example_script.py
Using config file /Users/dtenenba/dev/batch-demo/.pylintrc
************* Module example_script
W: 19, 0: FIXME do some logging here, print stack trace, etc (fixme)

------------------------------------------------------------------
Your code has been rated at 9.47/10 (previous run: 9.47/10, +0.00)

In Atom (linter-pylint 2.1.0) things work fine if I do not have a .pylintrc file, but as long as I do, I get a dialog that pops up that says:

[Linter] Error running Pylint
See Console for more info. (Open View -> Developer -> Toggle Developer Tools)

This is what it says in the console:

Linter] Error running Pylint Error: Using config file /Users/dtenenba/dev/batch-demo/.pylintrc
    at Object.<anonymous> (main.js [sm]:134)
    at Generator.next (<anonymous>)
    at step (/Users/dtenenba/.atom/packages/linter-pylint/lib/main.js:7)
(anonymous) @ linter-registry.js [sm]:137

If I remove the .pylintrc file everything works fine.
linter-pylint finds my .pylintrc whether it's in the current directory or my home directory, but I get the same behavior in both cases.

This happens regardless of the .pylintrc contents. In my case I generated the .pylintrc file with the command:

pylint --generate-rcfile > .pylintrc

...and did not modify it at all. I would like to, but only after this is resolved.

I'm working in a virtual environment (with pylint 1.8.1 installed in the virtualenv) and python 3.6.3, on macOS 10.12.6.

@scotthuang1989
Copy link

I have the same issue. I am using ubuntu 16.04 and install pylint in a virtual env.

@garrettXCIV
Copy link
Contributor

Check this highlighted section of Pylint code, as well as the diff starting where I highlighted down to line 650. You can also see these changes were added in Pylint 1.8.0 at the top of the diff.
Now check the release date for Pylint 1.8.0.

Do you see what's going on, and why, even when the commit was made half a year ago, it's just now affecting us? This all happened because of this issue.

The linter-pylint error is happening because, as of 1.8.0, Pylint now sends Using config file {FULL_PATH_PYLINTRC} to STDERR when a Pylint config file is specified, just like it had already been sending No config file found, using default configuration to STDERR when a config file wasn't specified, but linter-pylint (as of 12/17/17) only has the old error whitelisted. I already fixed it for myself, and it was very simple. I'll put in a pull request now.

@colelloa
Copy link

can confirm that applying @gucciferXCIV 's fix in #237 and then manually building the extension using apm install fixed this issue

@BobbyKilkins
Copy link

BobbyKilkins commented Sep 19, 2018

So how could I fix this issue? (I do not understand javascript) I tried adding the .+$ but it still doesn't work... Do I need to compile it somehow? I'm new to atom. Please help!

@BobbyKilkins
Copy link

Bump

@supermanzer
Copy link

I am currently encountering this error. When reviewing the console it was clear when my pylintrc file was not properly specified but now I'm stumped! Below is the console output


/Users/ryanmanzer/.atom/packages/linter/lib/linter-registry.js:155 [Linter] Error running Pylint Error: Traceback (most recent call last):
  File "/Users/ryanmanzer/anaconda/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File "/Users/ryanmanzer/anaconda/lib/python3.6/site-packages/pylint/__init__.py", line 19, in run_pylint
    Run(sys.argv[1:])
  File "/Users/ryanmanzer/anaconda/lib/python3.6/site-packages/pylint/lint.py", line 1359, in __init__
    linter.load_plugin_modules(plugins)
  File "/Users/ryanmanzer/anaconda/lib/python3.6/site-packages/pylint/lint.py", line 519, in load_plugin_modules
    module = modutils.load_module_from_name(modname)
  File "/Users/ryanmanzer/anaconda/lib/python3.6/site-packages/astroid/modutils.py", line 196, in load_module_from_name
    return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
  File "/Users/ryanmanzer/anaconda/lib/python3.6/site-packages/astroid/modutils.py", line 239, in load_module_from_modpath
    module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
  File "/Users/ryanmanzer/anaconda/lib/python3.6/imp.py", line 245, in load_module
    return load_package(name, filename)
  File "/Users/ryanmanzer/anaconda/lib/python3.6/imp.py", line 217, in load_package
    return _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/ryanmanzer/anaconda/lib/python3.6/site-packages/pylint_django/__init__.py", line 3, in <module>
    from pylint_django import plugin
  File "/Users/ryanmanzer/anaconda/lib/python3.6/site-packages/pylint_django/plugin.py", line 3, in <module>
    from pylint_django.augmentations import apply_augmentations
  File "/Users/ryanmanzer/anaconda/lib/python3.6/site-packages/pylint_django/augmentations/__init__.py", line 10, in <module>
    from astroid.scoped_nodes import Class as ScopedClass, Module
ImportError: cannot import name 'Class'
    at Object.<anonymous> (/Users/ryanmanzer/.atom/packages/linter-pylint/lib/main.js:161:17)
    at Generator.next (<anonymous>)
    at step (/Users/ryanmanzer/.atom/packages/linter-pylint/lib/main.js:7:273)
    at <anonymous>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants