Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pylint throws exception for unexpected keyword argument when running prospector. #266

Closed
justke86 opened this issue Jul 24, 2018 · 16 comments

Comments

@justke86
Copy link

justke86 commented Jul 24, 2018

I was running prospector using python 3.6 and the latest version of prospector, but when attempting to run it, it would just throw the following error:

Traceback (most recent call last):
  File "<redacted>/bin/prospector", line 11, in <module>
    sys.exit(main())
  File "<redacted>/lib/python3.6/site-packages/prospector/run.py", line 173, in main
    prospector.execute()
  File "<redacted>/lib/python3.6/site-packages/prospector/run.py", line 53, in execute
    for tool in self.config.get_tools(found_files):
  File "<redacted>/python3.6/site-packages/prospector/config/__init__.py", line 45, in get_tools
    config_result = tool.configure(self, found_files)
  File "<redacted>/python3.6/site-packages/prospector/tools/pylint/__init__.py", line 185, in configure
    config_messages += self._pylintrc_configure(pylintrc, linter)
  File "<redacted>/lib/python3.6/site-packages/prospector/tools/pylint/__init__.py", line 103, in _pylintrc_configure
    are_plugins_loaded = linter.config_from_file(pylintrc)
  File "<redacted>/lib/python3.6/site-packages/prospector/tools/pylint/linter.py", line 24, in config_from_file
    self.read_config_file(config_file, quiet=True)
TypeError: read_config_file() got an unexpected keyword argument 'quiet'

From reading through the prospector codebase and the pylint codebase, it looks like the line self.read_config_file(config_file, quiet=True) is using the old keyword argument quiet prior to it being updated to be verbose instead within pylint. This can be found in this commit: pylint-dev/pylint@49c6da5#diff-ade2cfcf3e840a993dbd465f517d91f5.

@carlio
Copy link
Member

carlio commented Jul 24, 2018

Could you let me know what version of prospector + pylint you are running with a pip freeze? I think I fixed that in this commit just yesterday for version 1.0 - 13214a0

You will have to upgrade prospector and pylint.

@justke86
Copy link
Author

I'm currently using pipenv 2018.7.1, and here's the pipenv graph when running into this issue:

14:03 $ pipenv graph
prospector==1.0
  - dodgy [required: >=0.1.9, installed: 0.1.9]
  - mccabe [required: >=0.5.0, installed: 0.6.1]
  - pep8-naming [required: >=0.3.3, installed: 0.7.0]
    - flake8-polyfill [required: >=1.0.2,<2, installed: 1.0.2]
      - flake8 [required: Any, installed: 3.5.0]
        - mccabe [required: >=0.6.0,<0.7.0, installed: 0.6.1]
        - pycodestyle [required: >=2.0.0,<2.4.0, installed: 2.3.1]
        - pyflakes [required: >=1.5.0,<1.7.0, installed: 1.6.0]
  - pycodestyle [required: >=2.0.0,<2.4.0, installed: 2.3.1]
  - pydocstyle [required: >=2.0.0, installed: 2.1.1]
    - six [required: Any, installed: 1.11.0]
    - snowballstemmer [required: Any, installed: 1.2.1]
  - pyflakes [required: >=0.8.1,<2.0.0, installed: 1.6.0]
  - pylint [required: >=2, installed: 2.0.1]
    - astroid [required: >=2.0.1, installed: 2.0.1]
      - lazy-object-proxy [required: Any, installed: 1.3.1]
      - six [required: Any, installed: 1.11.0]
      - typed-ast [required: Any, installed: 1.1.0]
      - wrapt [required: Any, installed: 1.10.11]
    - isort [required: >=4.2.5, installed: 4.3.4]
    - mccabe [required: Any, installed: 0.6.1]
  - pylint-common [required: >=0.2.5, installed: 0.2.5]
    - pylint [required: >=1.0, installed: 2.0.1]
      - astroid [required: >=2.0.1, installed: 2.0.1]
        - lazy-object-proxy [required: Any, installed: 1.3.1]
        - six [required: Any, installed: 1.11.0]
        - typed-ast [required: Any, installed: 1.1.0]
        - wrapt [required: Any, installed: 1.10.11]
      - isort [required: >=4.2.5, installed: 4.3.4]
      - mccabe [required: Any, installed: 0.6.1]
    - pylint-plugin-utils [required: >=0.2.5, installed: 0.4]
      - pylint [required: Any, installed: 2.0.1]
        - astroid [required: >=2.0.1, installed: 2.0.1]
          - lazy-object-proxy [required: Any, installed: 1.3.1]
          - six [required: Any, installed: 1.11.0]
          - typed-ast [required: Any, installed: 1.1.0]
          - wrapt [required: Any, installed: 1.10.11]
        - isort [required: >=4.2.5, installed: 4.3.4]
        - mccabe [required: Any, installed: 0.6.1]
  - pylint-plugin-utils [required: >=0.2.6, installed: 0.4]
    - pylint [required: Any, installed: 2.0.1]
      - astroid [required: >=2.0.1, installed: 2.0.1]
        - lazy-object-proxy [required: Any, installed: 1.3.1]
        - six [required: Any, installed: 1.11.0]
        - typed-ast [required: Any, installed: 1.1.0]
        - wrapt [required: Any, installed: 1.10.11]
      - isort [required: >=4.2.5, installed: 4.3.4]
      - mccabe [required: Any, installed: 0.6.1]
  - pyyaml [required: Any, installed: 3.13]
  - requirements-detector [required: >=0.6, installed: 0.6]
    - astroid [required: >=1.4, installed: 2.0.1]
      - lazy-object-proxy [required: Any, installed: 1.3.1]
      - six [required: Any, installed: 1.11.0]
      - typed-ast [required: Any, installed: 1.1.0]
      - wrapt [required: Any, installed: 1.10.11]
  - setoptconf [required: >=0.2.0, installed: 0.2.0]

Here's the pip freeze info from within the virtual env:

astroid==2.0.1
dodgy==0.1.9
flake8==3.5.0
flake8-polyfill==1.0.2
isort==4.3.4
lazy-object-proxy==1.3.1
mccabe==0.6.1
pep8-naming==0.7.0
prospector==1.0
pycodestyle==2.3.1
pydocstyle==2.1.1
pyflakes==1.6.0
pylint==2.0.1
pylint-common==0.2.5
pylint-plugin-utils==0.4
PyYAML==3.13
requirements-detector==0.6
setoptconf==0.2.0
six==1.11.0
snowballstemmer==1.2.1
typed-ast==1.1.0
wrapt==1.10.11

I'm using python 3.6.3 and I think I have the latest pylint and prospector.

@carlio
Copy link
Member

carlio commented Jul 24, 2018

Seems I must have misread the change when the quiet flag moved around. Thanks for pointing this out - I'll get on it ASAP.

@carlio
Copy link
Member

carlio commented Jul 24, 2018

Before pylint 2, it was called quiet but used in a different method ; I tried to make it work with old and new versions but missed that it was renamed in newer versions. Sorry about that.

@justke86
Copy link
Author

No problem, it happens, just figured I'd point it out so others don't run into similar issues, although from looking at your commit that you posted above, it looks like you may just need to move the quiet=True to the else block, right? I didn't dig deep enough into where you're setting PYLINT_VERSION to confirm though.

@carlio
Copy link
Member

carlio commented Jul 24, 2018

You're welcome to make a PR ;-) I probably can't get on to this until tomorrow.

PYLINT_VERSION is just loaded from pylint.__pkginfo__ so it's the exact same version that pylint uses in its setup.py.

@justke86
Copy link
Author

That's understandable, I was a little hesitant at first on the PR, but I gave it a shot: #267

@justke86
Copy link
Author

Is there any update on this issue?

@chocoelho chocoelho reopened this Jul 27, 2018
@chocoelho
Copy link
Contributor

Keeping this issue open until the fix is released.

@SeanDS
Copy link

SeanDS commented Jul 28, 2018

I also got this error on prospector 1.0 installed via PyPI.

@Doatti
Copy link

Doatti commented Oct 4, 2018

I still have this problem on prospector 1.1.2. Also using virtualenv. Here's my traceback:

Traceback (most recent call last):
  File "<redacted>/bin/prospector", line 11, in <module>
    load_entry_point('prospector==1.1.2', 'console_scripts', 'prospector')()
  File "<redacted>/local/lib/python2.7/site-packages/prospector/run.py", line 173, in main
    prospector.execute()
  File "<redacted>/local/lib/python2.7/site-packages/prospector/run.py", line 53, in execute
    for tool in self.config.get_tools(found_files):
  File "<redacted>/local/lib/python2.7/site-packages/prospector/config/__init__.py", line 41, in get_tools
    config_result = tool.configure(self, found_files)
  File "<redacted>/local/lib/python2.7/site-packages/prospector/tools/pylint/__init__.py", line 184, in configure
    config_messages += self._pylintrc_configure(pylintrc, linter)
  File "<redacted>/local/lib/python2.7/site-packages/prospector/tools/pylint/__init__.py", line 102, in _pylintrc_configure
    are_plugins_loaded = linter.config_from_file(pylintrc)
  File "<redacted>/local/lib/python2.7/site-packages/prospector/tools/pylint/linter.py", line 26, in config_from_file
    self.read_config_file(config_file, quiet=True)
TypeError: read_config_file() got an unexpected keyword argument 'quiet'

@kpachnis
Copy link
Contributor

kpachnis commented Oct 8, 2018

Pull request #283 solves this issue.

Looking at the Pylint history, the quiet argument never existed, at least from Pylint 1.5 onward, but it is was an instance variable of class OptionsManagerMixIn. In version 2.0.1 it was remove completely.

ltalirz added a commit to ltalirz/reentry that referenced this issue Oct 15, 2018
later versions have incorrect handling of 'quiet' flag for pylint<2
See landscapeio/prospector#266
DropD pushed a commit to aiidateam/reentry that referenced this issue Oct 17, 2018
* fix length of config file name

which could enable install on conda forge

* update yapf and prospector

* disable useless-object-inheritance warning

cannot make pylint happy both in python2 and 3

* fix python3 warnings

 + try to upgrade versions

* try fixing version updater

split setup.py into setup.py and setup.json
(logic was partly written for setup.json, was trying to load
setup.py as json file)

* fix package_data bug

* try fixing install issues

* include setup.json in manifest

* switch to local prospector installation

guykisel mirror was using v0.8 which was breaking pylint on py2.7

* fix prospector version

later versions have incorrect handling of 'quiet' flag for pylint<2
See landscapeio/prospector#266

* fix prospector verison

* updated: remove obsolete setup_version_pat
@ltalirz
Copy link

ltalirz commented Nov 15, 2018

@chocoelho Why did you close this issue?
The issue persists (cannot use prospector 1.1.4 with pylint <2), and there is a PR open (#283) to resolve it.
I checked and confirm that this PR resolves the issue.

Please consider merging #283 and releasing a new version of prospector.

@chocoelho
Copy link
Contributor

chocoelho commented Nov 16, 2018 via email

@chocoelho chocoelho reopened this Nov 17, 2018
@chocoelho
Copy link
Contributor

Can you please test again with 1.1.5?

@ltalirz
Copy link

ltalirz commented Nov 17, 2018

@chocoelho Thanks a lot, works for me!
From my side the issue can be closed.

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

No branches or pull requests

7 participants